Index: third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
index ac075b2a4934013fe6f5e10af681b23e3ec6b359..5e3d6b7ea6abed219a40588f7b51f48706712137 100644 |
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
@@ -415,11 +415,16 @@ void PerformanceBase::deliverObservationsTimerFired(Timer<PerformanceBase>*) |
} |
} |
+double toSafePrecisionTime(double timeInSeconds) |
+{ |
+ static const double precision = 0.000005; // in seconds |
+ return floor(timeInSeconds / precision) * precision; |
+} |
+ |
double PerformanceBase::now() const |
{ |
double nowSeconds = monotonicallyIncreasingTime() - m_timeOrigin; |
- const double resolutionSeconds = 0.000005; |
- return 1000.0 * floor(nowSeconds / resolutionSeconds) * resolutionSeconds; |
+ return 1000.0 * toSafePrecisionTime(nowSeconds); |
} |
DEFINE_TRACE(PerformanceBase) |