| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  635 } |  635 } | 
|  636  |  636  | 
|  637 // For logging use only. |  637 // For logging use only. | 
|  638 BASE_EXPORT std::ostream& operator<<(std::ostream& os, Time time); |  638 BASE_EXPORT std::ostream& operator<<(std::ostream& os, Time time); | 
|  639  |  639  | 
|  640 // TimeTicks ------------------------------------------------------------------ |  640 // TimeTicks ------------------------------------------------------------------ | 
|  641  |  641  | 
|  642 // Represents monotonically non-decreasing clock time. |  642 // Represents monotonically non-decreasing clock time. | 
|  643 class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> { |  643 class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> { | 
|  644  public: |  644  public: | 
 |  645   // The underlying clock used to generate new TimeTicks. | 
 |  646   enum class Clock { | 
 |  647     LINUX_CLOCK_MONOTONIC, | 
 |  648     IOS_CF_ABSOLUTE_TIME_MINUS_KERN_BOOTTIME, | 
 |  649     MAC_MACH_ABSOLUTE_TIME, | 
 |  650     WIN_QPC, | 
 |  651     WIN_ROLLOVER_PROTECTED_TIME_GET_TIME | 
 |  652   }; | 
 |  653  | 
|  645   TimeTicks() : TimeBase(0) { |  654   TimeTicks() : TimeBase(0) { | 
|  646   } |  655   } | 
|  647  |  656  | 
|  648   // Platform-dependent tick count representing "right now." When |  657   // Platform-dependent tick count representing "right now." When | 
|  649   // IsHighResolution() returns false, the resolution of the clock could be |  658   // IsHighResolution() returns false, the resolution of the clock could be | 
|  650   // as coarse as ~15.6ms. Otherwise, the resolution should be no worse than one |  659   // as coarse as ~15.6ms. Otherwise, the resolution should be no worse than one | 
|  651   // microsecond. |  660   // microsecond. | 
|  652   static TimeTicks Now(); |  661   static TimeTicks Now(); | 
|  653  |  662  | 
|  654   // Returns true if the high resolution clock is working on this system and |  663   // Returns true if the high resolution clock is working on this system and | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|  673   // the same value for the duration of the application, but will be different |  682   // the same value for the duration of the application, but will be different | 
|  674   // in future application runs. |  683   // in future application runs. | 
|  675   static TimeTicks UnixEpoch(); |  684   static TimeTicks UnixEpoch(); | 
|  676  |  685  | 
|  677   // Returns |this| snapped to the next tick, given a |tick_phase| and |  686   // Returns |this| snapped to the next tick, given a |tick_phase| and | 
|  678   // repeating |tick_interval| in both directions. |this| may be before, |  687   // repeating |tick_interval| in both directions. |this| may be before, | 
|  679   // after, or equal to the |tick_phase|. |  688   // after, or equal to the |tick_phase|. | 
|  680   TimeTicks SnappedToNextTick(TimeTicks tick_phase, |  689   TimeTicks SnappedToNextTick(TimeTicks tick_phase, | 
|  681                               TimeDelta tick_interval) const; |  690                               TimeDelta tick_interval) const; | 
|  682  |  691  | 
 |  692   // Returns an enum indicating the underlying clock being used to generate | 
 |  693   // TimeTicks timestamps. This function should only be used for debugging and | 
 |  694   // logging purposes. | 
 |  695   static Clock GetClock(); | 
 |  696  | 
|  683 #if defined(OS_WIN) |  697 #if defined(OS_WIN) | 
|  684  protected: |  698  protected: | 
|  685   typedef DWORD (*TickFunctionType)(void); |  699   typedef DWORD (*TickFunctionType)(void); | 
|  686   static TickFunctionType SetMockTickFunction(TickFunctionType ticker); |  700   static TickFunctionType SetMockTickFunction(TickFunctionType ticker); | 
|  687 #endif |  701 #endif | 
|  688  |  702  | 
|  689  private: |  703  private: | 
|  690   friend class time_internal::TimeBase<TimeTicks>; |  704   friend class time_internal::TimeBase<TimeTicks>; | 
|  691  |  705  | 
|  692   // Please use Now() to create a new object. This is for internal use |  706   // 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(); |  769   static void WaitUntilInitializedWin(); | 
|  756 #endif |  770 #endif | 
|  757 }; |  771 }; | 
|  758  |  772  | 
|  759 // For logging use only. |  773 // For logging use only. | 
|  760 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |  774 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 
|  761  |  775  | 
|  762 }  // namespace base |  776 }  // namespace base | 
|  763  |  777  | 
|  764 #endif  // BASE_TIME_TIME_H_ |  778 #endif  // BASE_TIME_TIME_H_ | 
| OLD | NEW |