From 604c8bd0bd1421f2160df0a11d59fa82547500bc Mon Sep 17 00:00:00 2001 From: "pfeldman@chromium.org" Date: Fri, 17 Dec 2010 08:15:34 +0000 Subject: DevTools: Network requests are timed with 1.6 days. BUG=65506 Review URL: http://codereview.chromium.org/5861008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69524 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/net/load_timing_observer.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/net/load_timing_observer.cc b/chrome/browser/net/load_timing_observer.cc index 326a699..53dab62 100644 --- a/chrome/browser/net/load_timing_observer.cc +++ b/chrome/browser/net/load_timing_observer.cc @@ -21,17 +21,21 @@ const size_t kMaxNumEntries = 1000; namespace { +const int64 kSyncPeriodMicroseconds = 1000 * 1000 * 10; + // We know that this conversion is not solid and suffers from world clock -// changes, but it should be good enough for the load timing info. +// changes, but given that we sync clock every 10 seconds, it should be good +// enough for the load timing info. static Time TimeTicksToTime(const TimeTicks& time_ticks) { static int64 tick_to_time_offset; - static bool tick_to_time_offset_available = false; - if (!tick_to_time_offset_available) { + static int64 last_sync_ticks = 0; + if (time_ticks.ToInternalValue() - last_sync_ticks > + kSyncPeriodMicroseconds) { int64 cur_time = (Time::Now() - Time()).InMicroseconds(); int64 cur_time_ticks = (TimeTicks::Now() - TimeTicks()).InMicroseconds(); // If we add this number to a time tick value, it gives the timestamp. tick_to_time_offset = cur_time - cur_time_ticks; - tick_to_time_offset_available = true; + last_sync_ticks = time_ticks.ToInternalValue(); } return Time::FromInternalValue(time_ticks.ToInternalValue() + tick_to_time_offset); -- cgit v1.1