| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // this function to deactivate the high resolution timer. | 531 // this function to deactivate the high resolution timer. |
| 532 static bool ActivateHighResolutionTimer(bool activate); | 532 static bool ActivateHighResolutionTimer(bool activate); |
| 533 | 533 |
| 534 // Returns true if the high resolution timer is both enabled and activated. | 534 // Returns true if the high resolution timer is both enabled and activated. |
| 535 // This is provided for testing only, and is not tracked in a thread-safe | 535 // This is provided for testing only, and is not tracked in a thread-safe |
| 536 // way. | 536 // way. |
| 537 static bool IsHighResolutionTimerInUse(); | 537 static bool IsHighResolutionTimerInUse(); |
| 538 #endif | 538 #endif |
| 539 | 539 |
| 540 // Converts an exploded structure representing either the local time or UTC | 540 // Converts an exploded structure representing either the local time or UTC |
| 541 // into a Time class. | |
| 542 // TODO(maksims): Get rid of these in favor of the methods below when | |
| 543 // all the callers stop using these ones. | |
| 544 static Time FromUTCExploded(const Exploded& exploded) { | |
| 545 base::Time time; | |
| 546 ignore_result(FromUTCExploded(exploded, &time)); | |
| 547 return time; | |
| 548 } | |
| 549 static Time FromLocalExploded(const Exploded& exploded) { | |
| 550 base::Time time; | |
| 551 ignore_result(FromLocalExploded(exploded, &time)); | |
| 552 return time; | |
| 553 } | |
| 554 | |
| 555 // Converts an exploded structure representing either the local time or UTC | |
| 556 // into a Time class. Returns false on a failure when, for example, a day of | 541 // into a Time class. Returns false on a failure when, for example, a day of |
| 557 // month is set to 31 on a 28-30 day month. Returns Time(0) on overflow. | 542 // month is set to 31 on a 28-30 day month. Returns Time(0) on overflow. |
| 558 static bool FromUTCExploded(const Exploded& exploded, | 543 static bool FromUTCExploded(const Exploded& exploded, |
| 559 Time* time) WARN_UNUSED_RESULT { | 544 Time* time) WARN_UNUSED_RESULT { |
| 560 return FromExploded(false, exploded, time); | 545 return FromExploded(false, exploded, time); |
| 561 } | 546 } |
| 562 static bool FromLocalExploded(const Exploded& exploded, | 547 static bool FromLocalExploded(const Exploded& exploded, |
| 563 Time* time) WARN_UNUSED_RESULT { | 548 Time* time) WARN_UNUSED_RESULT { |
| 564 return FromExploded(true, exploded, time); | 549 return FromExploded(true, exploded, time); |
| 565 } | 550 } |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 static void WaitUntilInitializedWin(); | 841 static void WaitUntilInitializedWin(); |
| 857 #endif | 842 #endif |
| 858 }; | 843 }; |
| 859 | 844 |
| 860 // For logging use only. | 845 // For logging use only. |
| 861 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 846 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
| 862 | 847 |
| 863 } // namespace base | 848 } // namespace base |
| 864 | 849 |
| 865 #endif // BASE_TIME_TIME_H_ | 850 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |