Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: net/quic/core/quic_time.h

Issue 2561893002: Add QUIC_EXPORT macros (Closed)
Patch Set: More Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_tag.h ('k') | net/quic/core/quic_transmission_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CORE_QUIC_TIME_H_ 11 #ifndef NET_QUIC_CORE_QUIC_TIME_H_
12 #define NET_QUIC_CORE_QUIC_TIME_H_ 12 #define NET_QUIC_CORE_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/quic/platform/api/quic_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 // A QuicTime is a purely relative time. QuicTime values from different clocks 27 // A QuicTime is a purely relative time. QuicTime values from different clocks
28 // cannot be compared to each other. If you need an absolute time, see 28 // cannot be compared to each other. If you need an absolute time, see
29 // QuicWallTime, below. 29 // QuicWallTime, below.
30 class NET_EXPORT_PRIVATE QuicTime { 30 class QUIC_EXPORT_PRIVATE QuicTime {
31 public: 31 public:
32 // A QuicTime::Delta represents the signed difference between two points in 32 // A QuicTime::Delta represents the signed difference between two points in
33 // time, stored in microsecond resolution. 33 // time, stored in microsecond resolution.
34 class NET_EXPORT_PRIVATE Delta { 34 class QUIC_EXPORT_PRIVATE Delta {
35 public: 35 public:
36 explicit Delta(base::TimeDelta delta); 36 explicit Delta(base::TimeDelta delta);
37 37
38 // Create a object with an offset of 0. 38 // Create a object with an offset of 0.
39 static QUICTIME_CONSTEXPR Delta Zero() { return Delta(0); } 39 static QUICTIME_CONSTEXPR Delta Zero() { return Delta(0); }
40 40
41 // Create a object with infinite offset time. 41 // Create a object with infinite offset time.
42 static QUICTIME_CONSTEXPR Delta Infinite() { 42 static QUICTIME_CONSTEXPR Delta Infinite() {
43 return Delta(kQuicInfiniteTimeUs); 43 return Delta(kQuicInfiniteTimeUs);
44 } 44 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 friend inline QuicTime::Delta operator-(QuicTime lhs, QuicTime rhs); 131 friend inline QuicTime::Delta operator-(QuicTime lhs, QuicTime rhs);
132 132
133 explicit QUICTIME_CONSTEXPR QuicTime(int64_t time) : time_(time) {} 133 explicit QUICTIME_CONSTEXPR QuicTime(int64_t time) : time_(time) {}
134 134
135 int64_t time_; 135 int64_t time_;
136 }; 136 };
137 137
138 // A QuicWallTime represents an absolute time that is globally consistent. In 138 // A QuicWallTime represents an absolute time that is globally consistent. In
139 // practice, clock-skew means that comparing values from different machines 139 // practice, clock-skew means that comparing values from different machines
140 // requires some flexibility. 140 // requires some flexibility.
141 class NET_EXPORT_PRIVATE QuicWallTime { 141 class QUIC_EXPORT_PRIVATE QuicWallTime {
142 public: 142 public:
143 // FromUNIXSeconds constructs a QuicWallTime from a count of the seconds 143 // FromUNIXSeconds constructs a QuicWallTime from a count of the seconds
144 // since the UNIX epoch. 144 // since the UNIX epoch.
145 static QUICTIME_CONSTEXPR QuicWallTime FromUNIXSeconds(uint64_t seconds) { 145 static QUICTIME_CONSTEXPR QuicWallTime FromUNIXSeconds(uint64_t seconds) {
146 return QuicWallTime(seconds * 1000000); 146 return QuicWallTime(seconds * 1000000);
147 } 147 }
148 148
149 static QUICTIME_CONSTEXPR QuicWallTime 149 static QUICTIME_CONSTEXPR QuicWallTime
150 FromUNIXMicroseconds(uint64_t microseconds) { 150 FromUNIXMicroseconds(uint64_t microseconds) {
151 return QuicWallTime(microseconds); 151 return QuicWallTime(microseconds);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 // Override stream output operator for gtest. 266 // Override stream output operator for gtest.
267 inline std::ostream& operator<<(std::ostream& output, 267 inline std::ostream& operator<<(std::ostream& output,
268 const QuicTime::Delta delta) { 268 const QuicTime::Delta delta) {
269 output << delta.ToDebugValue(); 269 output << delta.ToDebugValue();
270 return output; 270 return output;
271 } 271 }
272 } // namespace net 272 } // namespace net
273 273
274 #endif // NET_QUIC_CORE_QUIC_TIME_H_ 274 #endif // NET_QUIC_CORE_QUIC_TIME_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_tag.h ('k') | net/quic/core/quic_transmission_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698