| 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 |
| 11 #ifndef NET_QUIC_QUIC_TIME_H_ | 11 #ifndef NET_QUIC_QUIC_TIME_H_ |
| 12 #define NET_QUIC_QUIC_TIME_H_ | 12 #define NET_QUIC_QUIC_TIME_H_ |
| 13 | 13 |
| 14 #include <stdint.h> | 14 #include <stdint.h> |
| 15 | 15 |
| 16 #include <cmath> | 16 #include <cmath> |
| 17 #include <ostream> | 17 #include <ostream> |
| 18 | 18 |
| 19 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
| 22 | 22 |
| 23 #define QUICTIME_CONSTEXPR inline | 23 #define QUICTIME_CONSTEXPR inline |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 | 26 |
| 27 static const int kNumSecondsPerMinute = 60; | 27 static const int kNumSecondsPerMinute = 60; |
| 28 static const int kNumSecondsPerHour = kNumSecondsPerMinute * 60; | 28 static const int kNumSecondsPerHour = kNumSecondsPerMinute * 60; |
| 29 static const uint64_t kNumSecondsPerWeek = kNumSecondsPerHour * 24 * 7; |
| 29 static const uint64_t kNumMicrosPerSecond = base::Time::kMicrosecondsPerSecond; | 30 static const uint64_t kNumMicrosPerSecond = base::Time::kMicrosecondsPerSecond; |
| 30 static const uint64_t kNumMicrosPerMilli = | 31 static const uint64_t kNumMicrosPerMilli = |
| 31 base::Time::kMicrosecondsPerMillisecond; | 32 base::Time::kMicrosecondsPerMillisecond; |
| 32 | 33 |
| 33 // A QuicTime is a purely relative time. QuicTime values from different clocks | 34 // A QuicTime is a purely relative time. QuicTime values from different clocks |
| 34 // cannot be compared to each other. If you need an absolute time, see | 35 // cannot be compared to each other. If you need an absolute time, see |
| 35 // QuicWallTime, below. | 36 // QuicWallTime, below. |
| 36 class NET_EXPORT_PRIVATE QuicTime { | 37 class NET_EXPORT_PRIVATE QuicTime { |
| 37 public: | 38 public: |
| 38 // A QuicTime::Delta represents the signed difference between two points in | 39 // A QuicTime::Delta represents the signed difference between two points in |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 272 |
| 272 // Override stream output operator for gtest. | 273 // Override stream output operator for gtest. |
| 273 inline std::ostream& operator<<(std::ostream& output, | 274 inline std::ostream& operator<<(std::ostream& output, |
| 274 const QuicTime::Delta delta) { | 275 const QuicTime::Delta delta) { |
| 275 output << delta.ToDebugValue(); | 276 output << delta.ToDebugValue(); |
| 276 return output; | 277 return output; |
| 277 } | 278 } |
| 278 } // namespace net | 279 } // namespace net |
| 279 | 280 |
| 280 #endif // NET_QUIC_QUIC_TIME_H_ | 281 #endif // NET_QUIC_QUIC_TIME_H_ |
| OLD | NEW |