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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 constexpr bool operator<=(TimeDelta other) const { | 235 constexpr bool operator<=(TimeDelta other) const { |
236 return delta_ <= other.delta_; | 236 return delta_ <= other.delta_; |
237 } | 237 } |
238 constexpr bool operator>(TimeDelta other) const { | 238 constexpr bool operator>(TimeDelta other) const { |
239 return delta_ > other.delta_; | 239 return delta_ > other.delta_; |
240 } | 240 } |
241 constexpr bool operator>=(TimeDelta other) const { | 241 constexpr bool operator>=(TimeDelta other) const { |
242 return delta_ >= other.delta_; | 242 return delta_ >= other.delta_; |
243 } | 243 } |
244 | 244 |
245 // This works around crbug.com/635974 | |
246 constexpr TimeDelta(const TimeDelta& other) : delta_(other.delta_) {} | |
miu
2016/08/11 21:48:56
Since the bug is Windows-specific, please surround
liberato (no reviews please)
2016/08/11 22:10:35
Done.
| |
247 | |
245 private: | 248 private: |
246 friend int64_t time_internal::SaturatedAdd(TimeDelta delta, int64_t value); | 249 friend int64_t time_internal::SaturatedAdd(TimeDelta delta, int64_t value); |
247 friend int64_t time_internal::SaturatedSub(TimeDelta delta, int64_t value); | 250 friend int64_t time_internal::SaturatedSub(TimeDelta delta, int64_t value); |
248 | 251 |
249 // Constructs a delta given the duration in microseconds. This is private | 252 // Constructs a delta given the duration in microseconds. This is private |
250 // to avoid confusion by callers with an integer constructor. Use | 253 // to avoid confusion by callers with an integer constructor. Use |
251 // FromSeconds, FromMilliseconds, etc. instead. | 254 // FromSeconds, FromMilliseconds, etc. instead. |
252 constexpr explicit TimeDelta(int64_t delta_us) : delta_(delta_us) {} | 255 constexpr explicit TimeDelta(int64_t delta_us) : delta_(delta_us) {} |
253 | 256 |
254 // Private method to build a delta from a double. | 257 // Private method to build a delta from a double. |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 static void WaitUntilInitializedWin(); | 833 static void WaitUntilInitializedWin(); |
831 #endif | 834 #endif |
832 }; | 835 }; |
833 | 836 |
834 // For logging use only. | 837 // For logging use only. |
835 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 838 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
836 | 839 |
837 } // namespace base | 840 } // namespace base |
838 | 841 |
839 #endif // BASE_TIME_TIME_H_ | 842 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |