Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: net/cert/x509_cert_types.cc

Issue 2090713003: Make callers of FromUTC(Local)Exploded in net/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from eroman@ Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(); 74 valid &= exploded.HasValidValues();
eroman 2016/10/27 21:44:34 This line is redundant with the call to FromUTCExp
maksims (do not use this acc) 2016/11/29 07:38:56 No. FromUTCExploded doesn't perform this kind of c
eroman 2016/11/30 00:21:05 FromUTCExploded() returns a boolean indicating suc
maksims (do not use this acc) 2016/12/05 13:15:49 Sorry, I was wrong. it's ok to remove this line.
75 75
76 if (!valid) 76 if (!valid)
77 return false; 77 return false;
78 78
79 *time = base::Time::FromUTCExploded(exploded); 79 // FromUTCExploded() can fail even though exploded.HasValidValues()
80 return true; 80 // returned true.
81 return base::Time::FromUTCExploded(exploded, time);
81 } 82 }
82 83
83 } // namespace net 84 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698