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 #include "net/quic/quic_time.h" | 5 #include "net/quic/quic_time.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 bool QuicTime::Delta::IsInfinite() const { | 83 bool QuicTime::Delta::IsInfinite() const { |
84 return delta_.InMicroseconds() == kQuicInfiniteTimeUs; | 84 return delta_.InMicroseconds() == kQuicInfiniteTimeUs; |
85 } | 85 } |
86 | 86 |
87 // static | 87 // static |
88 QuicTime QuicTime::Zero() { | 88 QuicTime QuicTime::Zero() { |
89 return QuicTime(base::TimeTicks()); | 89 return QuicTime(base::TimeTicks()); |
90 } | 90 } |
91 | 91 |
92 // static | 92 // static |
| 93 QuicTime QuicTime::Infinite() { |
| 94 return QuicTime(base::TimeTicks::FromInternalValue(kQuicInfiniteTimeUs)); |
| 95 } |
| 96 |
| 97 // static |
93 QuicTime QuicTime::Max(QuicTime time1, QuicTime time2) { | 98 QuicTime QuicTime::Max(QuicTime time1, QuicTime time2) { |
94 return time1 > time2 ? time1 : time2; | 99 return time1 > time2 ? time1 : time2; |
95 } | 100 } |
96 | 101 |
97 QuicTime::QuicTime(base::TimeTicks ticks) | 102 QuicTime::QuicTime(base::TimeTicks ticks) |
98 : ticks_(ticks) { | 103 : ticks_(ticks) { |
99 } | 104 } |
100 | 105 |
101 int64 QuicTime::ToDebuggingValue() const { | 106 int64 QuicTime::ToDebuggingValue() const { |
102 return (ticks_ - base::TimeTicks()).InMicroseconds(); | 107 return (ticks_ - base::TimeTicks()).InMicroseconds(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 seconds = 0; | 178 seconds = 0; |
174 } | 179 } |
175 return QuicWallTime(seconds); | 180 return QuicWallTime(seconds); |
176 } | 181 } |
177 | 182 |
178 QuicWallTime::QuicWallTime(uint64 seconds) | 183 QuicWallTime::QuicWallTime(uint64 seconds) |
179 : seconds_(seconds) { | 184 : seconds_(seconds) { |
180 } | 185 } |
181 | 186 |
182 } // namespace net | 187 } // namespace net |
OLD | NEW |