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

Unified Diff: net/quic/platform/impl/quic_chromium_clock.cc

Issue 2871573009: Use clock_gettime instead of base::TimeTicks::Now() in QUIC (Closed)
Patch Set: Fallback Created 3 years, 7 months 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/platform/api/quic_clock.h ('k') | net/quic/platform/impl/quic_chromium_clock_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/platform/impl/quic_chromium_clock.cc
diff --git a/net/quic/platform/impl/quic_chromium_clock.cc b/net/quic/platform/impl/quic_chromium_clock.cc
index cbf1ed1b14e2c94199da029c3ec1a69e13a7a96a..fb591f842feffedc69d6145f50771c62b7e1ac14 100644
--- a/net/quic/platform/impl/quic_chromium_clock.cc
+++ b/net/quic/platform/impl/quic_chromium_clock.cc
@@ -4,6 +4,12 @@
#include "net/quic/platform/impl/quic_chromium_clock.h"
+#if defined(OS_IOS)
+#include <time.h>
+
+#include "base/ios/ios_util.h"
+#endif
+
#include "base/memory/singleton.h"
#include "base/time/time.h"
@@ -23,7 +29,16 @@ QuicTime QuicChromiumClock::ApproximateNow() const {
}
QuicTime QuicChromiumClock::Now() const {
- return QuicTime(base::TimeTicks::Now());
+#if defined(OS_IOS)
+ if (base::ios::IsRunningOnIOS10OrLater()) {
+ struct timespec tp;
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
+ return CreateTimeFromMicroseconds(tp.tv_sec * 1000000 +
+ tp.tv_nsec / 1000);
+ }
+ }
+#endif
+ return CreateTimeFromMicroseconds(base::TimeTicks::Now().ToInternalValue());
}
QuicWallTime QuicChromiumClock::WallNow() const {
« no previous file with comments | « net/quic/platform/api/quic_clock.h ('k') | net/quic/platform/impl/quic_chromium_clock_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698