Chromium Code Reviews| 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 // Time represents an absolute point in coordinated universal time (UTC), | 5 // Time represents an absolute point in coordinated universal time (UTC), |
| 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch | 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch |
| 7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are | 7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are |
| 8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump | 8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump |
| 9 // around as the operating system makes adjustments to synchronize (e.g., with | 9 // around as the operating system makes adjustments to synchronize (e.g., with |
| 10 // NTP servers). Thus, client code that uses the Time class must account for | 10 // NTP servers). Thus, client code that uses the Time class must account for |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 return time; | 538 return time; |
| 539 } | 539 } |
| 540 static Time FromLocalExploded(const Exploded& exploded) { | 540 static Time FromLocalExploded(const Exploded& exploded) { |
| 541 base::Time time; | 541 base::Time time; |
| 542 ignore_result(FromLocalExploded(exploded, &time)); | 542 ignore_result(FromLocalExploded(exploded, &time)); |
| 543 return time; | 543 return time; |
| 544 } | 544 } |
| 545 | 545 |
| 546 // Converts an exploded structure representing either the local time or UTC | 546 // Converts an exploded structure representing either the local time or UTC |
| 547 // into a Time class. Returns false on a failure when, for example, a day of | 547 // into a Time class. Returns false on a failure when, for example, a day of |
| 548 // month is set to 31 on a 28-30 day month. | 548 // month is set to 31 on a 28-30 day month. Returns maximum possible |
|
miu
2016/10/18 19:55:13
IMO, if there is any overflow, this function shoul
maksims (do not use this acc)
2016/10/19 16:41:04
That's a typo. At first I thought it would be like
| |
| 549 // platform dependent time on overflow. | |
| 549 static bool FromUTCExploded(const Exploded& exploded, | 550 static bool FromUTCExploded(const Exploded& exploded, |
| 550 Time* time) WARN_UNUSED_RESULT { | 551 Time* time) WARN_UNUSED_RESULT { |
| 551 return FromExploded(false, exploded, time); | 552 return FromExploded(false, exploded, time); |
| 552 } | 553 } |
| 553 static bool FromLocalExploded(const Exploded& exploded, | 554 static bool FromLocalExploded(const Exploded& exploded, |
| 554 Time* time) WARN_UNUSED_RESULT { | 555 Time* time) WARN_UNUSED_RESULT { |
| 555 return FromExploded(true, exploded, time); | 556 return FromExploded(true, exploded, time); |
| 556 } | 557 } |
| 557 | 558 |
| 558 // Converts a string representation of time to a Time object. | 559 // Converts a string representation of time to a Time object. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 842 static void WaitUntilInitializedWin(); | 843 static void WaitUntilInitializedWin(); |
| 843 #endif | 844 #endif |
| 844 }; | 845 }; |
| 845 | 846 |
| 846 // For logging use only. | 847 // For logging use only. |
| 847 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 848 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
| 848 | 849 |
| 849 } // namespace base | 850 } // namespace base |
| 850 | 851 |
| 851 #endif // BASE_TIME_TIME_H_ | 852 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |