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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 // the same value for the duration of the application, but will be different | 673 // the same value for the duration of the application, but will be different |
674 // in future application runs. | 674 // in future application runs. |
675 static TimeTicks UnixEpoch(); | 675 static TimeTicks UnixEpoch(); |
676 | 676 |
677 // Returns |this| snapped to the next tick, given a |tick_phase| and | 677 // Returns |this| snapped to the next tick, given a |tick_phase| and |
678 // repeating |tick_interval| in both directions. |this| may be before, | 678 // repeating |tick_interval| in both directions. |this| may be before, |
679 // after, or equal to the |tick_phase|. | 679 // after, or equal to the |tick_phase|. |
680 TimeTicks SnappedToNextTick(TimeTicks tick_phase, | 680 TimeTicks SnappedToNextTick(TimeTicks tick_phase, |
681 TimeDelta tick_interval) const; | 681 TimeDelta tick_interval) const; |
682 | 682 |
683 // Returns a string identifier for the underlying clock being used to generate | |
684 // TimeTicks timestamps (e.g. LINUX_CLOCK_MONOTONIC_MICROS, WIN_QPC_MICROS). | |
685 // This function should only be used for debugging and logging purposes. | |
686 static std::string ClockId(); | |
danakj
2016/03/26 00:40:33
it looks like this can return const char*.
i kind
charliea (OOO until 10-5)
2016/03/28 15:40:51
Definitely agree that it makes it hard to see the
danakj
2016/03/28 17:53:50
https://code.google.com/p/chromium/codesearch#chro
danakj
2016/03/28 17:54:21
(And I think that such a function would belong in
charliea (OOO until 10-5)
2016/03/28 21:07:36
Done.
| |
687 | |
683 #if defined(OS_WIN) | 688 #if defined(OS_WIN) |
684 protected: | 689 protected: |
685 typedef DWORD (*TickFunctionType)(void); | 690 typedef DWORD (*TickFunctionType)(void); |
686 static TickFunctionType SetMockTickFunction(TickFunctionType ticker); | 691 static TickFunctionType SetMockTickFunction(TickFunctionType ticker); |
687 #endif | 692 #endif |
688 | 693 |
689 private: | 694 private: |
690 friend class time_internal::TimeBase<TimeTicks>; | 695 friend class time_internal::TimeBase<TimeTicks>; |
691 | 696 |
692 // Please use Now() to create a new object. This is for internal use | 697 // Please use Now() to create a new object. This is for internal use |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 static void WaitUntilInitializedWin(); | 760 static void WaitUntilInitializedWin(); |
756 #endif | 761 #endif |
757 }; | 762 }; |
758 | 763 |
759 // For logging use only. | 764 // For logging use only. |
760 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 765 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
761 | 766 |
762 } // namespace base | 767 } // namespace base |
763 | 768 |
764 #endif // BASE_TIME_TIME_H_ | 769 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |