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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 // returns true. Each successful activate call must be paired with a | 542 // returns true. Each successful activate call must be paired with a |
543 // subsequent deactivate call. | 543 // subsequent deactivate call. |
544 // All callers to activate the high resolution timer must eventually call | 544 // All callers to activate the high resolution timer must eventually call |
545 // this function to deactivate the high resolution timer. | 545 // this function to deactivate the high resolution timer. |
546 static bool ActivateHighResolutionTimer(bool activate); | 546 static bool ActivateHighResolutionTimer(bool activate); |
547 | 547 |
548 // Returns true if the high resolution timer is both enabled and activated. | 548 // Returns true if the high resolution timer is both enabled and activated. |
549 // This is provided for testing only, and is not tracked in a thread-safe | 549 // This is provided for testing only, and is not tracked in a thread-safe |
550 // way. | 550 // way. |
551 static bool IsHighResolutionTimerInUse(); | 551 static bool IsHighResolutionTimerInUse(); |
552 | |
553 // The following two functions are used to report the fraction of elapsed time | |
554 // that the high resolution timer is activated. | |
555 // ResetHighResolutionTimerUsage() resets the cumulative usage and starts the | |
556 // measurement interval and GetHighResolutionTimerUsage() returns the | |
557 // percentage of time since the reset that the high resolution timer was | |
558 // activated. | |
gab
2017/06/28 16:39:33
Also document that Get() is invalid before Reset()
stanisc
2017/06/28 22:28:35
Done.
| |
559 static void ResetHighResolutionTimerUsage(); | |
560 static double GetHighResolutionTimerUsage(); | |
552 #endif | 561 #endif |
gab
2017/06/28 16:39:33
#endif // defined(OS_WIN)
(this block is becomin
stanisc
2017/06/28 22:28:35
Done.
| |
553 | 562 |
554 // Converts an exploded structure representing either the local time or UTC | 563 // Converts an exploded structure representing either the local time or UTC |
555 // into a Time class. Returns false on a failure when, for example, a day of | 564 // into a Time class. Returns false on a failure when, for example, a day of |
556 // month is set to 31 on a 28-30 day month. Returns Time(0) on overflow. | 565 // month is set to 31 on a 28-30 day month. Returns Time(0) on overflow. |
557 static bool FromUTCExploded(const Exploded& exploded, | 566 static bool FromUTCExploded(const Exploded& exploded, |
558 Time* time) WARN_UNUSED_RESULT { | 567 Time* time) WARN_UNUSED_RESULT { |
559 return FromExploded(false, exploded, time); | 568 return FromExploded(false, exploded, time); |
560 } | 569 } |
561 static bool FromLocalExploded(const Exploded& exploded, | 570 static bool FromLocalExploded(const Exploded& exploded, |
562 Time* time) WARN_UNUSED_RESULT { | 571 Time* time) WARN_UNUSED_RESULT { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 static void WaitUntilInitializedWin(); | 880 static void WaitUntilInitializedWin(); |
872 #endif | 881 #endif |
873 }; | 882 }; |
874 | 883 |
875 // For logging use only. | 884 // For logging use only. |
876 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 885 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
877 | 886 |
878 } // namespace base | 887 } // namespace base |
879 | 888 |
880 #endif // BASE_TIME_TIME_H_ | 889 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |