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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 // Converts units of time to TimeDeltas. | 109 // Converts units of time to TimeDeltas. |
110 static constexpr TimeDelta FromDays(int days); | 110 static constexpr TimeDelta FromDays(int days); |
111 static constexpr TimeDelta FromHours(int hours); | 111 static constexpr TimeDelta FromHours(int hours); |
112 static constexpr TimeDelta FromMinutes(int minutes); | 112 static constexpr TimeDelta FromMinutes(int minutes); |
113 static constexpr TimeDelta FromSeconds(int64_t secs); | 113 static constexpr TimeDelta FromSeconds(int64_t secs); |
114 static constexpr TimeDelta FromMilliseconds(int64_t ms); | 114 static constexpr TimeDelta FromMilliseconds(int64_t ms); |
115 static constexpr TimeDelta FromSecondsD(double secs); | 115 static constexpr TimeDelta FromSecondsD(double secs); |
116 static constexpr TimeDelta FromMillisecondsD(double ms); | 116 static constexpr TimeDelta FromMillisecondsD(double ms); |
117 static constexpr TimeDelta FromMicroseconds(int64_t us); | 117 static constexpr TimeDelta FromMicroseconds(int64_t us); |
| 118 #if defined(OS_POSIX) |
| 119 static TimeDelta FromTimeSpec(const timespec& ts); |
| 120 #endif |
118 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
119 static TimeDelta FromQPCValue(LONGLONG qpc_value); | 122 static TimeDelta FromQPCValue(LONGLONG qpc_value); |
120 #endif | 123 #endif |
121 | 124 |
122 // Converts an integer value representing TimeDelta to a class. This is used | 125 // Converts an integer value representing TimeDelta to a class. This is used |
123 // when deserializing a |TimeDelta| structure, using a value known to be | 126 // when deserializing a |TimeDelta| structure, using a value known to be |
124 // compatible. It is not provided as a constructor because the integer type | 127 // compatible. It is not provided as a constructor because the integer type |
125 // may be unclear from the perspective of a caller. | 128 // may be unclear from the perspective of a caller. |
126 static TimeDelta FromInternalValue(int64_t delta) { return TimeDelta(delta); } | 129 static TimeDelta FromInternalValue(int64_t delta) { return TimeDelta(delta); } |
127 | 130 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 static void WaitUntilInitializedWin(); | 838 static void WaitUntilInitializedWin(); |
836 #endif | 839 #endif |
837 }; | 840 }; |
838 | 841 |
839 // For logging use only. | 842 // For logging use only. |
840 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 843 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
841 | 844 |
842 } // namespace base | 845 } // namespace base |
843 | 846 |
844 #endif // BASE_TIME_TIME_H_ | 847 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |