OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/cert/x509_cert_types.h" | 5 #include "net/cert/x509_cert_types.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <cstring> | 8 #include <cstring> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 | 64 |
65 exploded.year = ParseIntAndAdvance(&field, year_length, &valid); | 65 exploded.year = ParseIntAndAdvance(&field, year_length, &valid); |
66 exploded.month = ParseIntAndAdvance(&field, 2, &valid); | 66 exploded.month = ParseIntAndAdvance(&field, 2, &valid); |
67 exploded.day_of_month = ParseIntAndAdvance(&field, 2, &valid); | 67 exploded.day_of_month = ParseIntAndAdvance(&field, 2, &valid); |
68 exploded.hour = ParseIntAndAdvance(&field, 2, &valid); | 68 exploded.hour = ParseIntAndAdvance(&field, 2, &valid); |
69 exploded.minute = ParseIntAndAdvance(&field, 2, &valid); | 69 exploded.minute = ParseIntAndAdvance(&field, 2, &valid); |
70 exploded.second = ParseIntAndAdvance(&field, 2, &valid); | 70 exploded.second = ParseIntAndAdvance(&field, 2, &valid); |
71 if (valid && year_length == 2) | 71 if (valid && year_length == 2) |
72 exploded.year += exploded.year < 50 ? 2000 : 1900; | 72 exploded.year += exploded.year < 50 ? 2000 : 1900; |
73 | 73 |
74 valid &= exploded.HasValidValues(); | |
75 | |
76 if (!valid) | 74 if (!valid) |
77 return false; | 75 return false; |
78 | 76 |
79 *time = base::Time::FromUTCExploded(exploded); | 77 // FromUTCExploded() can fail even though exploded.HasValidValues() |
eroman
2016/12/08 01:39:19
This comment is no longer relevant, please remove
maksims (do not use this acc)
2016/12/13 08:56:09
Done.
| |
80 return true; | 78 // returned true. |
79 return base::Time::FromUTCExploded(exploded, time); | |
81 } | 80 } |
82 | 81 |
83 } // namespace net | 82 } // namespace net |
OLD | NEW |