| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 static bool use_fake_clock_; | 76 static bool use_fake_clock_; |
| 77 static int64_t fake_ticks_; | 77 static int64_t fake_ticks_; |
| 78 | 78 |
| 79 int64_t ticks_; | 79 int64_t ticks_; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // Represents a time delta in ticks. | 82 // Represents a time delta in ticks. |
| 83 class TickInterval { | 83 class TickInterval { |
| 84 public: | 84 public: |
| 85 TickInterval(); | 85 TickInterval(); |
| 86 explicit TickInterval(int64_t interval); | |
| 87 | 86 |
| 88 int64_t Milliseconds() const; | 87 int64_t Milliseconds() const; |
| 89 int64_t Microseconds() const; | 88 int64_t Microseconds() const; |
| 90 | 89 |
| 91 // Returns the sum of two TickIntervals as a TickInterval. | 90 // Returns the sum of two TickIntervals as a TickInterval. |
| 92 friend TickInterval operator+(const TickInterval& lhs, | 91 friend TickInterval operator+(const TickInterval& lhs, |
| 93 const TickInterval& rhs); | 92 const TickInterval& rhs); |
| 94 TickInterval& operator+=(const TickInterval& rhs); | 93 TickInterval& operator+=(const TickInterval& rhs); |
| 95 | 94 |
| 96 // Returns a TickInterval corresponding to rhs - lhs. | 95 // Returns a TickInterval corresponding to rhs - lhs. |
| 97 friend TickInterval operator-(const TickInterval& lhs, | 96 friend TickInterval operator-(const TickInterval& lhs, |
| 98 const TickInterval& rhs); | 97 const TickInterval& rhs); |
| 99 TickInterval& operator-=(const TickInterval& rhs); | 98 TickInterval& operator-=(const TickInterval& rhs); |
| 100 | 99 |
| 101 friend bool operator>(const TickInterval& lhs, const TickInterval& rhs); | 100 friend bool operator>(const TickInterval& lhs, const TickInterval& rhs); |
| 102 friend bool operator<=(const TickInterval& lhs, const TickInterval& rhs); | 101 friend bool operator<=(const TickInterval& lhs, const TickInterval& rhs); |
| 103 friend bool operator<(const TickInterval& lhs, const TickInterval& rhs); | 102 friend bool operator<(const TickInterval& lhs, const TickInterval& rhs); |
| 104 friend bool operator>=(const TickInterval& lhs, const TickInterval& rhs); | 103 friend bool operator>=(const TickInterval& lhs, const TickInterval& rhs); |
| 105 | 104 |
| 106 private: | 105 private: |
| 106 explicit TickInterval(int64_t interval); |
| 107 |
| 107 friend class TickTime; | 108 friend class TickTime; |
| 108 friend TickInterval operator-(const TickTime& lhs, const TickTime& rhs); | 109 friend TickInterval operator-(const TickTime& lhs, const TickTime& rhs); |
| 109 | 110 |
| 110 private: | 111 private: |
| 111 int64_t interval_; | 112 int64_t interval_; |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 inline TickInterval operator+(const TickInterval& lhs, | 115 inline TickInterval operator+(const TickInterval& lhs, |
| 115 const TickInterval& rhs) { | 116 const TickInterval& rhs) { |
| 116 return TickInterval(lhs.interval_ + rhs.interval_); | 117 return TickInterval(lhs.interval_ + rhs.interval_); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 289 } |
| 289 | 290 |
| 290 inline TickInterval& TickInterval::operator-=(const TickInterval& rhs) { | 291 inline TickInterval& TickInterval::operator-=(const TickInterval& rhs) { |
| 291 interval_ -= rhs.interval_; | 292 interval_ -= rhs.interval_; |
| 292 return *this; | 293 return *this; |
| 293 } | 294 } |
| 294 | 295 |
| 295 } // namespace webrtc | 296 } // namespace webrtc |
| 296 | 297 |
| 297 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TICK_UTIL_H_ | 298 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TICK_UTIL_H_ |
| OLD | NEW |