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 "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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 return time; | 228 return time; |
229 } | 229 } |
230 | 230 |
231 Time Time::LocalMidnight() const { | 231 Time Time::LocalMidnight() const { |
232 Exploded exploded; | 232 Exploded exploded; |
233 LocalExplode(&exploded); | 233 LocalExplode(&exploded); |
234 exploded.hour = 0; | 234 exploded.hour = 0; |
235 exploded.minute = 0; | 235 exploded.minute = 0; |
236 exploded.second = 0; | 236 exploded.second = 0; |
237 exploded.millisecond = 0; | 237 exploded.millisecond = 0; |
238 return FromLocalExploded(exploded); | 238 Time out_time; |
239 if (FromLocalExploded(exploded, &out_time)) | |
240 return out_time; | |
241 // This function must not fail. | |
maksims (do not use this acc)
2016/12/13 11:43:55
miu, How do you think? Should a return value from
| |
242 NOTREACHED(); | |
243 return Time(); | |
239 } | 244 } |
240 | 245 |
241 // static | 246 // static |
242 bool Time::FromStringInternal(const char* time_string, | 247 bool Time::FromStringInternal(const char* time_string, |
243 bool is_local, | 248 bool is_local, |
244 Time* parsed_time) { | 249 Time* parsed_time) { |
245 DCHECK((time_string != NULL) && (parsed_time != NULL)); | 250 DCHECK((time_string != NULL) && (parsed_time != NULL)); |
246 | 251 |
247 if (time_string[0] == '\0') | 252 if (time_string[0] == '\0') |
248 return false; | 253 return false; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 return is_in_range(month, 1, 12) && | 347 return is_in_range(month, 1, 12) && |
343 is_in_range(day_of_week, 0, 6) && | 348 is_in_range(day_of_week, 0, 6) && |
344 is_in_range(day_of_month, 1, 31) && | 349 is_in_range(day_of_month, 1, 31) && |
345 is_in_range(hour, 0, 23) && | 350 is_in_range(hour, 0, 23) && |
346 is_in_range(minute, 0, 59) && | 351 is_in_range(minute, 0, 59) && |
347 is_in_range(second, 0, 60) && | 352 is_in_range(second, 0, 60) && |
348 is_in_range(millisecond, 0, 999); | 353 is_in_range(millisecond, 0, 999); |
349 } | 354 } |
350 | 355 |
351 } // namespace base | 356 } // namespace base |
OLD | NEW |