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

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: Cleanup 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..dc705b2723e93cd9942021ccd08d711f1b245759 100644
--- a/net/quic/platform/impl/quic_chromium_clock.cc
+++ b/net/quic/platform/impl/quic_chromium_clock.cc
@@ -4,8 +4,15 @@
#include "net/quic/platform/impl/quic_chromium_clock.h"
-#include "base/memory/singleton.h"
+#if defined(OS_IOS)
+// Use clock_gettime on iOS>
Zhongyi Shi 2017/05/09 23:30:57 IIRC, clock_gettime is supported and works fine on
ianswett 2017/05/10 00:44:56 +1
Ryan Hamilton 2017/05/10 03:06:04 *facepalm* Done.
+#include <time.h>
+#else
+// Use base::TimeTicks::Now() elsewhere.
#include "base/time/time.h"
+#endif
+
+#include "base/memory/singleton.h"
namespace net {
@@ -23,7 +30,13 @@ QuicTime QuicChromiumClock::ApproximateNow() const {
}
QuicTime QuicChromiumClock::Now() const {
- return QuicTime(base::TimeTicks::Now());
+#if defined(OS_IOS)
+ struct timespec tp;
+ clock_gettime(CLOCK_MONOTONIC, &tp);
+ return MakeTime(tp.tv_nsec / 1000);
+#else
+ return MakeTime(base::TimeTicks::Now().ToInternalValue());
+#endif
}
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