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 TimeTicks is consistent across processes, meaning that |
| 711 // timestamps taken on different processes can be safely compared with one |
| 712 // another. (Note that, even on platforms where this returns true, time values |
| 713 // from different threads that are within one tick of each other must be |
| 714 // considered to have an ambiguous ordering.) |
| 715 static bool IsConsistentAcrossProcesses(); |
| 716 |
710 #if defined(OS_WIN) | 717 #if defined(OS_WIN) |
711 // Translates an absolute QPC timestamp into a TimeTicks value. The returned | 718 // 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 | 719 // value has the same origin as Now(). Do NOT attempt to use this if |
713 // IsHighResolution() returns false. | 720 // IsHighResolution() returns false. |
714 static TimeTicks FromQPCValue(LONGLONG qpc_value); | 721 static TimeTicks FromQPCValue(LONGLONG qpc_value); |
715 #endif | 722 #endif |
716 | 723 |
717 // Get an estimate of the TimeTick value at the time of the UnixEpoch. Because | 724 // 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 | 725 // Time and TimeTicks respond differently to user-set time and NTP |
719 // adjustments, this number is only an estimate. Nevertheless, this can be | 726 // 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(); | 824 static void WaitUntilInitializedWin(); |
818 #endif | 825 #endif |
819 }; | 826 }; |
820 | 827 |
821 // For logging use only. | 828 // For logging use only. |
822 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 829 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
823 | 830 |
824 } // namespace base | 831 } // namespace base |
825 | 832 |
826 #endif // BASE_TIME_TIME_H_ | 833 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |