Chromium Code Reviews| 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 { |