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

Unified Diff: net/quic/quic_time.h

Issue 1421853006: Landing Recent QUIC changes until: Fri Oct 30 22:23:58 2015 +0000 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_stream_sequencer_test.cc ('k') | net/quic/quic_time.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_time.h
diff --git a/net/quic/quic_time.h b/net/quic/quic_time.h
index 99b3afd5c915ff03929a60d4dfdb76e088b512bb..5637837d7deefb228887a8cbb06402395a2667d0 100644
--- a/net/quic/quic_time.h
+++ b/net/quic/quic_time.h
@@ -159,24 +159,30 @@ class NET_EXPORT_PRIVATE QuicTime {
int64 time_;
};
-// A QuicWallTime represents an absolute time that is globally consistent. It
-// provides, at most, one second granularity and, in practice, clock-skew means
-// that you shouldn't even depend on that.
+// A QuicWallTime represents an absolute time that is globally consistent. In
+// practice, clock-skew means that comparing values from different machines
+// requires some flexibility in interpretation.
class NET_EXPORT_PRIVATE QuicWallTime {
public:
// FromUNIXSeconds constructs a QuicWallTime from a count of the seconds
// since the UNIX epoch.
static QUICTIME_CONSTEXPR QuicWallTime FromUNIXSeconds(uint64 seconds) {
- return QuicWallTime(seconds);
+ return QuicWallTime(seconds * 1000000);
+ }
+
+ static QUICTIME_CONSTEXPR QuicWallTime
+ FromUNIXMicroseconds(uint64 microseconds) {
+ return QuicWallTime(microseconds);
}
// Zero returns a QuicWallTime set to zero. IsZero will return true for this
// value.
static QUICTIME_CONSTEXPR QuicWallTime Zero() { return QuicWallTime(0); }
- // ToUNIXSeconds converts a QuicWallTime into a count of seconds since the
- // UNIX epoch.
+ // Returns the number of seconds since the UNIX epoch.
uint64 ToUNIXSeconds() const;
+ // Returns the number of microseconds since the UNIX epoch.
+ uint64 ToUNIXMicroseconds() const;
bool IsAfter(QuicWallTime other) const;
bool IsBefore(QuicWallTime other) const;
@@ -197,10 +203,10 @@ class NET_EXPORT_PRIVATE QuicWallTime {
QuicWallTime Subtract(QuicTime::Delta delta) const WARN_UNUSED_RESULT;
private:
- explicit QUICTIME_CONSTEXPR QuicWallTime(uint64 seconds)
- : seconds_(seconds) {}
+ explicit QUICTIME_CONSTEXPR QuicWallTime(uint64 microseconds)
+ : microseconds_(microseconds) {}
- uint64 seconds_;
+ uint64 microseconds_;
};
// Non-member relational operators for QuicTime::Delta.
« no previous file with comments | « net/quic/quic_stream_sequencer_test.cc ('k') | net/quic/quic_time.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698