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

Side by Side Diff: components/network_time/network_time_tracker.cc

Issue 296453005: Componentize chrome/browser/network_time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix iOS Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/network_time/network_time_tracker.h" 5 #include "components/network_time/network_time_tracker.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/tick_clock.h" 13 #include "base/time/tick_clock.h"
14 #include "chrome/common/pref_names.h" 14 #include "components/network_time/network_time_pref_names.h"
15
16 namespace network_time {
15 17
16 namespace { 18 namespace {
17 19
18 // Clock resolution is platform dependent. 20 // Clock resolution is platform dependent.
19 #if defined(OS_WIN) 21 #if defined(OS_WIN)
20 const int64 kTicksResolutionMs = base::Time::kMinLowResolutionThresholdMs; 22 const int64 kTicksResolutionMs = base::Time::kMinLowResolutionThresholdMs;
21 #else 23 #else
22 const int64 kTicksResolutionMs = 1; // Assume 1ms for non-windows platforms. 24 const int64 kTicksResolutionMs = 1; // Assume 1ms for non-windows platforms.
23 #endif 25 #endif
24 26
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 DCHECK(thread_checker_.CalledOnValidThread()); 114 DCHECK(thread_checker_.CalledOnValidThread());
113 DCHECK(network_time); 115 DCHECK(network_time);
114 if (network_time_.is_null()) 116 if (network_time_.is_null())
115 return false; 117 return false;
116 DCHECK(!network_time_ticks_.is_null()); 118 DCHECK(!network_time_ticks_.is_null());
117 *network_time = network_time_ + (time_ticks - network_time_ticks_); 119 *network_time = network_time_ + (time_ticks - network_time_ticks_);
118 if (uncertainty) 120 if (uncertainty)
119 *uncertainty = network_time_uncertainty_; 121 *uncertainty = network_time_uncertainty_;
120 return true; 122 return true;
121 } 123 }
124
125 } // namespace network_time
OLDNEW
« no previous file with comments | « components/network_time/network_time_tracker.h ('k') | components/network_time/network_time_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698