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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 QuicWallTime QuicWallTime::Add(QuicTime::Delta delta) const { | 168 QuicWallTime QuicWallTime::Add(QuicTime::Delta delta) const { |
169 uint64 seconds = seconds_ + delta.ToSeconds(); | 169 uint64 seconds = seconds_ + delta.ToSeconds(); |
170 if (seconds < seconds_) { | 170 if (seconds < seconds_) { |
171 seconds = kuint64max; | 171 seconds = kuint64max; |
172 } | 172 } |
173 return QuicWallTime(seconds); | 173 return QuicWallTime(seconds); |
174 } | 174 } |
175 | 175 |
| 176 // TODO(ianswett) Test this. |
176 QuicWallTime QuicWallTime::Subtract(QuicTime::Delta delta) const { | 177 QuicWallTime QuicWallTime::Subtract(QuicTime::Delta delta) const { |
177 uint64 seconds = seconds_ - delta.ToSeconds(); | 178 uint64 seconds = seconds_ - delta.ToSeconds(); |
178 if (seconds > seconds_) { | 179 if (seconds > seconds_) { |
179 seconds = 0; | 180 seconds = 0; |
180 } | 181 } |
181 return QuicWallTime(seconds); | 182 return QuicWallTime(seconds); |
182 } | 183 } |
183 | 184 |
184 QuicWallTime::QuicWallTime(uint64 seconds) | 185 QuicWallTime::QuicWallTime(uint64 seconds) |
185 : seconds_(seconds) { | 186 : seconds_(seconds) { |
186 } | 187 } |
187 | 188 |
188 } // namespace net | 189 } // namespace net |
OLD | NEW |