| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 QuicTime::Delta QuicTime::Delta::Subtract(const Delta& delta) const { | 60 QuicTime::Delta QuicTime::Delta::Subtract(const Delta& delta) const { |
| 61 return QuicTime::Delta::FromMicroseconds(ToMicroseconds() - | 61 return QuicTime::Delta::FromMicroseconds(ToMicroseconds() - |
| 62 delta.ToMicroseconds()); | 62 delta.ToMicroseconds()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 QuicTime::Delta QuicTime::Delta::Multiply(int i) const { | 65 QuicTime::Delta QuicTime::Delta::Multiply(int i) const { |
| 66 return QuicTime::Delta::FromMicroseconds(ToMicroseconds() * i); | 66 return QuicTime::Delta::FromMicroseconds(ToMicroseconds() * i); |
| 67 } | 67 } |
| 68 | 68 |
| 69 QuicTime::Delta QuicTime::Delta::Multiply(double d) const { | 69 QuicTime::Delta QuicTime::Delta::Multiply(double d) const { |
| 70 return QuicTime::Delta::FromMicroseconds(ToMicroseconds() * d); | 70 return QuicTime::Delta::FromMicroseconds( |
| 71 static_cast<int64>(ToMicroseconds() * d)); |
| 71 } | 72 } |
| 72 | 73 |
| 73 // static | 74 // static |
| 74 QuicTime::Delta QuicTime::Delta::Max(QuicTime::Delta delta1, | 75 QuicTime::Delta QuicTime::Delta::Max(QuicTime::Delta delta1, |
| 75 QuicTime::Delta delta2) { | 76 QuicTime::Delta delta2) { |
| 76 return delta1 < delta2 ? delta2 : delta1; | 77 return delta1 < delta2 ? delta2 : delta1; |
| 77 } | 78 } |
| 78 | 79 |
| 79 bool QuicTime::Delta::IsZero() const { | 80 bool QuicTime::Delta::IsZero() const { |
| 80 return delta_.InMicroseconds() == 0; | 81 return delta_.InMicroseconds() == 0; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 seconds = 0; | 179 seconds = 0; |
| 179 } | 180 } |
| 180 return QuicWallTime(seconds); | 181 return QuicWallTime(seconds); |
| 181 } | 182 } |
| 182 | 183 |
| 183 QuicWallTime::QuicWallTime(uint64 seconds) | 184 QuicWallTime::QuicWallTime(uint64 seconds) |
| 184 : seconds_(seconds) { | 185 : seconds_(seconds) { |
| 185 } | 186 } |
| 186 | 187 |
| 187 } // namespace net | 188 } // namespace net |
| OLD | NEW |