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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 // as coarse as ~15.6ms. Otherwise, the resolution should be no worse than one | 700 // as coarse as ~15.6ms. Otherwise, the resolution should be no worse than one |
701 // microsecond. | 701 // microsecond. |
702 static TimeTicks Now(); | 702 static TimeTicks Now(); |
703 | 703 |
704 // Returns true if the high resolution clock is working on this system and | 704 // Returns true if the high resolution clock is working on this system and |
705 // Now() will return high resolution values. Note that, on systems where the | 705 // Now() will return high resolution values. Note that, on systems where the |
706 // high resolution clock works but is deemed inefficient, the low resolution | 706 // high resolution clock works but is deemed inefficient, the low resolution |
707 // clock will be used instead. | 707 // clock will be used instead. |
708 static bool IsHighResolution(); | 708 static bool IsHighResolution(); |
709 | 709 |
710 // Returns true if tick clock is consistent across processes meaning that | |
711 // tick counts taken on different processes can be safely compared with one | |
712 // another. Time values from different threads that differ 1 tick have an | |
charliea (OOO until 10-5)
2016/06/29 22:38:54
A couple suggestions:
1) s/tick clock/TimeTicks
2
majidvp
2016/07/05 01:45:37
Done.
| |
713 // ambiguous ordering. | |
714 static bool IsConsistentAcrossProcesses(); | |
charliea (OOO until 10-5)
2016/06/29 22:38:54
It looks like, in all cases, IsConsistentAcrossPro
majidvp
2016/07/05 01:45:37
This is true but that should be seen as a "coincid
charliea (OOO until 10-5)
2016/07/06 17:43:52
Acknowledged.
| |
715 | |
710 #if defined(OS_WIN) | 716 #if defined(OS_WIN) |
711 // Translates an absolute QPC timestamp into a TimeTicks value. The returned | 717 // Translates an absolute QPC timestamp into a TimeTicks value. The returned |
712 // value has the same origin as Now(). Do NOT attempt to use this if | 718 // value has the same origin as Now(). Do NOT attempt to use this if |
713 // IsHighResolution() returns false. | 719 // IsHighResolution() returns false. |
714 static TimeTicks FromQPCValue(LONGLONG qpc_value); | 720 static TimeTicks FromQPCValue(LONGLONG qpc_value); |
715 #endif | 721 #endif |
716 | 722 |
717 // Get an estimate of the TimeTick value at the time of the UnixEpoch. Because | 723 // Get an estimate of the TimeTick value at the time of the UnixEpoch. Because |
718 // Time and TimeTicks respond differently to user-set time and NTP | 724 // Time and TimeTicks respond differently to user-set time and NTP |
719 // adjustments, this number is only an estimate. Nevertheless, this can be | 725 // adjustments, this number is only an estimate. Nevertheless, this can be |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 static void WaitUntilInitializedWin(); | 823 static void WaitUntilInitializedWin(); |
818 #endif | 824 #endif |
819 }; | 825 }; |
820 | 826 |
821 // For logging use only. | 827 // For logging use only. |
822 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 828 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
823 | 829 |
824 } // namespace base | 830 } // namespace base |
825 | 831 |
826 #endif // BASE_TIME_TIME_H_ | 832 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |