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

Unified Diff: chrome/browser/net/load_timing_observer.cc

Issue 5861008: DevTools: Network requests are timed with 1.6 days. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/load_timing_observer.cc
diff --git a/chrome/browser/net/load_timing_observer.cc b/chrome/browser/net/load_timing_observer.cc
index 326a6995db97d81d41bd812709de5020c2129ea5..9aeca863ef860708ce1cfef5c2b32c7b984d5518 100644
--- a/chrome/browser/net/load_timing_observer.cc
+++ b/chrome/browser/net/load_timing_observer.cc
@@ -21,17 +21,20 @@ const size_t kMaxNumEntries = 1000;
namespace {
+const int64 kSyncPeriod = 1000 * 1000 * 10;
tonyg 2010/12/16 22:21:03 I'd recommend adding the units to the name: kSyncP
+
// 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 > kSyncPeriod) {
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698