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

Unified Diff: net/quic/quic_time.cc

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_time.h ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_time.cc
diff --git a/net/quic/quic_time.cc b/net/quic/quic_time.cc
index cd59953c3fc5bc22d2514ce2b6d550abe05d7ba0..83217180c386fa70e93b93d514eae0966515bb67 100644
--- a/net/quic/quic_time.cc
+++ b/net/quic/quic_time.cc
@@ -11,51 +11,55 @@
namespace net {
uint64 QuicWallTime::ToUNIXSeconds() const {
- return seconds_;
+ return microseconds_ / 1000000;
+}
+
+uint64 QuicWallTime::ToUNIXMicroseconds() const {
+ return microseconds_;
}
bool QuicWallTime::IsAfter(QuicWallTime other) const {
- return seconds_ > other.seconds_;
+ return microseconds_ > other.microseconds_;
}
bool QuicWallTime::IsBefore(QuicWallTime other) const {
- return seconds_ < other.seconds_;
+ return microseconds_ < other.microseconds_;
}
bool QuicWallTime::IsZero() const {
- return seconds_ == 0;
+ return microseconds_ == 0;
}
QuicTime::Delta QuicWallTime::AbsoluteDifference(QuicWallTime other) const {
uint64 d;
- if (seconds_ > other.seconds_) {
- d = seconds_ - other.seconds_;
+ if (microseconds_ > other.microseconds_) {
+ d = microseconds_ - other.microseconds_;
} else {
- d = other.seconds_ - seconds_;
+ d = other.microseconds_ - microseconds_;
}
if (d > static_cast<uint64>(kint64max)) {
d = kint64max;
}
- return QuicTime::Delta::FromSeconds(d);
+ return QuicTime::Delta::FromMicroseconds(d);
}
QuicWallTime QuicWallTime::Add(QuicTime::Delta delta) const {
- uint64 seconds = seconds_ + delta.ToSeconds();
- if (seconds < seconds_) {
- seconds = kuint64max;
+ uint64 microseconds = microseconds_ + delta.ToMicroseconds();
+ if (microseconds < microseconds_) {
+ microseconds = kuint64max;
}
- return QuicWallTime(seconds);
+ return QuicWallTime(microseconds);
}
// TODO(ianswett) Test this.
QuicWallTime QuicWallTime::Subtract(QuicTime::Delta delta) const {
- uint64 seconds = seconds_ - delta.ToSeconds();
- if (seconds > seconds_) {
- seconds = 0;
+ uint64 microseconds = microseconds_ - delta.ToMicroseconds();
+ if (microseconds > microseconds_) {
+ microseconds = 0;
}
- return QuicWallTime(seconds);
+ return QuicWallTime(microseconds);
}
} // namespace net
« no previous file with comments | « net/quic/quic_time.h ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698