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

Unified Diff: content/renderer/stats_collection_controller.cc

Issue 557953006: Avoid using ToInternalValue in computing timings, so that the timings are consistent accross platfo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « components/startup_metric_utils/startup_metric_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/stats_collection_controller.cc
diff --git a/content/renderer/stats_collection_controller.cc b/content/renderer/stats_collection_controller.cc
index 713407942a7f95b34d8e00cf452882b57a3f1bcc..da615e0dde6938e6c6ab9ef5d11c11c320e99c8e 100644
--- a/content/renderer/stats_collection_controller.cc
+++ b/content/renderer/stats_collection_controller.cc
@@ -47,7 +47,7 @@ bool CurrentRenderViewImpl(RenderViewImpl** out) {
// Example return value:
// {'load_start_ms': 1, 'load_duration_ms': 2.5}
// either value may be null if a web contents hasn't fully loaded.
-// load_start_ms is represented as milliseconds since system boot.
+// load_start_ms is represented as milliseconds since the unix epoch.
void ConvertLoadTimeToJSON(
const base::Time& load_start_time,
const base::Time& load_stop_time,
@@ -57,7 +57,8 @@ void ConvertLoadTimeToJSON(
if (load_start_time.is_null()) {
item.Set("load_start_ms", base::Value::CreateNullValue());
} else {
- item.SetDouble("load_start_ms", load_start_time.ToInternalValue() / 1000);
+ item.SetDouble("load_start_ms", (load_start_time - base::Time::UnixEpoch())
+ .InMillisecondsF());
}
if (load_start_time.is_null() || load_stop_time.is_null()) {
item.Set("load_duration_ms", base::Value::CreateNullValue());
« no previous file with comments | « components/startup_metric_utils/startup_metric_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698