| 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 // QuicTime represents one point in time, stored in microsecond resolution. | 5 // QuicTime represents one point in time, stored in microsecond resolution. |
| 6 // QuicTime is monotonically increasing, even across system clock adjustments. | 6 // QuicTime is monotonically increasing, even across system clock adjustments. |
| 7 // The epoch (time 0) of QuicTime is unspecified. | 7 // The epoch (time 0) of QuicTime is unspecified. |
| 8 // | 8 // |
| 9 // This implementation wraps the classes base::TimeTicks and base::TimeDelta. | 9 // This implementation wraps the classes base::TimeTicks and base::TimeDelta. |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 // A QuicWallTime represents an absolute time that is globally consistent. It | 102 // A QuicWallTime represents an absolute time that is globally consistent. It |
| 103 // provides, at most, one second granularity and, in practice, clock-skew means | 103 // provides, at most, one second granularity and, in practice, clock-skew means |
| 104 // that you shouldn't even depend on that. | 104 // that you shouldn't even depend on that. |
| 105 class NET_EXPORT_PRIVATE QuicWallTime { | 105 class NET_EXPORT_PRIVATE QuicWallTime { |
| 106 public: | 106 public: |
| 107 // FromUNIXSeconds constructs a QuicWallTime from a count of the seconds | 107 // FromUNIXSeconds constructs a QuicWallTime from a count of the seconds |
| 108 // since the UNIX epoch. | 108 // since the UNIX epoch. |
| 109 static QuicWallTime FromUNIXSeconds(uint64 seconds); | 109 static QuicWallTime FromUNIXSeconds(uint64 seconds); |
| 110 | 110 |
| 111 // Zero returns a QuicWallTime set to zero. IsZero will return true for this |
| 112 // value. |
| 113 static QuicWallTime Zero(); |
| 114 |
| 111 // ToUNIXSeconds converts a QuicWallTime into a count of seconds since the | 115 // ToUNIXSeconds converts a QuicWallTime into a count of seconds since the |
| 112 // UNIX epoch. | 116 // UNIX epoch. |
| 113 uint64 ToUNIXSeconds() const; | 117 uint64 ToUNIXSeconds() const; |
| 114 | 118 |
| 115 bool IsAfter(QuicWallTime other) const; | 119 bool IsAfter(QuicWallTime other) const; |
| 116 bool IsBefore(QuicWallTime other) const; | 120 bool IsBefore(QuicWallTime other) const; |
| 117 | 121 |
| 122 // IsZero returns true if this object is the result of calling |Zero|. |
| 123 bool IsZero() const; |
| 124 |
| 118 // AbsoluteDifference returns the absolute value of the time difference | 125 // AbsoluteDifference returns the absolute value of the time difference |
| 119 // between |this| and |other|. | 126 // between |this| and |other|. |
| 120 QuicTime::Delta AbsoluteDifference(QuicWallTime other) const; | 127 QuicTime::Delta AbsoluteDifference(QuicWallTime other) const; |
| 121 | 128 |
| 122 // Add returns a new QuicWallTime that represents the time of |this| plus | 129 // Add returns a new QuicWallTime that represents the time of |this| plus |
| 123 // |delta|. | 130 // |delta|. |
| 124 QuicWallTime Add(QuicTime::Delta delta) const; | 131 QuicWallTime Add(QuicTime::Delta delta) const; |
| 125 | 132 |
| 126 // Subtract returns a new QuicWallTime that represents the time of |this| | 133 // Subtract returns a new QuicWallTime that represents the time of |this| |
| 127 // minus |delta|. | 134 // minus |delta|. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 inline bool operator<=(QuicTime lhs, QuicTime rhs) { | 175 inline bool operator<=(QuicTime lhs, QuicTime rhs) { |
| 169 return !(rhs < lhs); | 176 return !(rhs < lhs); |
| 170 } | 177 } |
| 171 inline bool operator>=(QuicTime lhs, QuicTime rhs) { | 178 inline bool operator>=(QuicTime lhs, QuicTime rhs) { |
| 172 return !(lhs < rhs); | 179 return !(lhs < rhs); |
| 173 } | 180 } |
| 174 | 181 |
| 175 } // namespace net | 182 } // namespace net |
| 176 | 183 |
| 177 #endif // NET_QUIC_QUIC_TIME_H_ | 184 #endif // NET_QUIC_QUIC_TIME_H_ |
| OLD | NEW |