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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 // clock will be used instead. | 678 // clock will be used instead. |
679 static bool IsHighResolution(); | 679 static bool IsHighResolution(); |
680 | 680 |
681 #if defined(OS_WIN) | 681 #if defined(OS_WIN) |
682 // Translates an absolute QPC timestamp into a TimeTicks value. The returned | 682 // Translates an absolute QPC timestamp into a TimeTicks value. The returned |
683 // value has the same origin as Now(). Do NOT attempt to use this if | 683 // value has the same origin as Now(). Do NOT attempt to use this if |
684 // IsHighResolution() returns false. | 684 // IsHighResolution() returns false. |
685 static TimeTicks FromQPCValue(LONGLONG qpc_value); | 685 static TimeTicks FromQPCValue(LONGLONG qpc_value); |
686 #endif | 686 #endif |
687 | 687 |
688 // Get the TimeTick value at the time of the UnixEpoch. This is useful when | 688 // Get an estimate of the TimeTick value at the time of the UnixEpoch. Because |
689 // you need to relate the value of TimeTicks to a real time and date. | 689 // Time and TimeTicks respond differently to user-set time and NTP |
690 // Note: Upon first invocation, this function takes a snapshot of the realtime | 690 // adjustments, this number is only an estimate. Nevertheless, this can be |
691 // clock to establish a reference point. This function will return the same | 691 // useful when you need to relate the value of TimeTicks to a real time and |
692 // value for the duration of the application, but will be different in future | 692 // date. Note: Upon first invocation, this function takes a snapshot of the |
693 // application runs. | 693 // realtime clock to establish a reference point. This function will return |
| 694 // the same value for the duration of the application, but will be different |
| 695 // in future application runs. |
694 static TimeTicks UnixEpoch(); | 696 static TimeTicks UnixEpoch(); |
695 | 697 |
696 // Returns |this| snapped to the next tick, given a |tick_phase| and | 698 // Returns |this| snapped to the next tick, given a |tick_phase| and |
697 // repeating |tick_interval| in both directions. |this| may be before, | 699 // repeating |tick_interval| in both directions. |this| may be before, |
698 // after, or equal to the |tick_phase|. | 700 // after, or equal to the |tick_phase|. |
699 TimeTicks SnappedToNextTick(TimeTicks tick_phase, | 701 TimeTicks SnappedToNextTick(TimeTicks tick_phase, |
700 TimeDelta tick_interval) const; | 702 TimeDelta tick_interval) const; |
701 | 703 |
702 #if defined(OS_WIN) | 704 #if defined(OS_WIN) |
703 protected: | 705 protected: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 explicit TraceTicks(int64 us) : TimeBase(us) { | 799 explicit TraceTicks(int64 us) : TimeBase(us) { |
798 } | 800 } |
799 }; | 801 }; |
800 | 802 |
801 // For logging use only. | 803 // For logging use only. |
802 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TraceTicks time_ticks); | 804 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TraceTicks time_ticks); |
803 | 805 |
804 } // namespace base | 806 } // namespace base |
805 | 807 |
806 #endif // BASE_TIME_TIME_H_ | 808 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |