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

Unified Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 1352523002: Use high precision timestamp for Event.timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
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)

Powered by Google App Engine
This is Rietveld 408576698