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

Unified Diff: net/quic/quic_time.h

Issue 1421873007: Change QuicWallTime to have microsecond granularity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106444524
Patch Set: 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
Index: net/quic/quic_time.h
diff --git a/net/quic/quic_time.h b/net/quic/quic_time.h
index 99b3afd5c915ff03929a60d4dfdb76e088b512bb..6e2ca56cdd0f7c9e571dfa1828669c00723b07c9 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 flex
ramant (doing other things) 2015/11/03 00:33:10 overly nit: period at the end of sentence.
Ryan Hamilton 2015/11/04 04:10:11 Done.
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_clock.cc ('k') | net/quic/quic_time.cc » ('j') | net/tools/quic/quic_epoll_clock.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698