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

Side by Side Diff: base/time/time.cc

Issue 2569913003: [base::Time] Follow-up cl: Remove deprecated FromLocalExploded FromUTCExploded (Closed)
Patch Set: rebased Created 4 years 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
« no previous file with comments | « base/time/time.h ('k') | chromecast/crash/linux/dump_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/time/time.h" 5 #include "base/time/time.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <ios> 8 #include <ios>
9 #include <limits> 9 #include <limits>
10 #include <ostream> 10 #include <ostream>
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return time; 223 return time;
224 } 224 }
225 225
226 Time Time::LocalMidnight() const { 226 Time Time::LocalMidnight() const {
227 Exploded exploded; 227 Exploded exploded;
228 LocalExplode(&exploded); 228 LocalExplode(&exploded);
229 exploded.hour = 0; 229 exploded.hour = 0;
230 exploded.minute = 0; 230 exploded.minute = 0;
231 exploded.second = 0; 231 exploded.second = 0;
232 exploded.millisecond = 0; 232 exploded.millisecond = 0;
233 return FromLocalExploded(exploded); 233 Time out_time;
234 if (FromLocalExploded(exploded, &out_time))
235 return out_time;
236 // This function must not fail.
237 NOTREACHED();
238 return Time();
234 } 239 }
235 240
236 // static 241 // static
237 bool Time::FromStringInternal(const char* time_string, 242 bool Time::FromStringInternal(const char* time_string,
238 bool is_local, 243 bool is_local,
239 Time* parsed_time) { 244 Time* parsed_time) {
240 DCHECK((time_string != NULL) && (parsed_time != NULL)); 245 DCHECK((time_string != NULL) && (parsed_time != NULL));
241 246
242 if (time_string[0] == '\0') 247 if (time_string[0] == '\0')
243 return false; 248 return false;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return is_in_range(month, 1, 12) && 342 return is_in_range(month, 1, 12) &&
338 is_in_range(day_of_week, 0, 6) && 343 is_in_range(day_of_week, 0, 6) &&
339 is_in_range(day_of_month, 1, 31) && 344 is_in_range(day_of_month, 1, 31) &&
340 is_in_range(hour, 0, 23) && 345 is_in_range(hour, 0, 23) &&
341 is_in_range(minute, 0, 59) && 346 is_in_range(minute, 0, 59) &&
342 is_in_range(second, 0, 60) && 347 is_in_range(second, 0, 60) &&
343 is_in_range(millisecond, 0, 999); 348 is_in_range(millisecond, 0, 999);
344 } 349 }
345 350
346 } // namespace base 351 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time.h ('k') | chromecast/crash/linux/dump_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698