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

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

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/network_time/network_time_tracker.h" 5 #include "components/network_time/network_time_tracker.h"
6 6
7 #include "base/basictypes.h" 7 #include <stdint.h>
8
8 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
11 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/tick_clock.h" 14 #include "base/time/tick_clock.h"
15 #include "build/build_config.h"
14 #include "components/network_time/network_time_pref_names.h" 16 #include "components/network_time/network_time_pref_names.h"
15 17
16 namespace network_time { 18 namespace network_time {
17 19
18 namespace { 20 namespace {
19 21
20 // Clock resolution is platform dependent. 22 // Clock resolution is platform dependent.
21 #if defined(OS_WIN) 23 #if defined(OS_WIN)
22 const int64 kTicksResolutionMs = base::Time::kMinLowResolutionThresholdMs; 24 const int64_t kTicksResolutionMs = base::Time::kMinLowResolutionThresholdMs;
23 #else 25 #else
24 const int64 kTicksResolutionMs = 1; // Assume 1ms for non-windows platforms. 26 const int64_t kTicksResolutionMs = 1; // Assume 1ms for non-windows platforms.
25 #endif 27 #endif
26 28
27 // Number of time measurements performed in a given network time calculation. 29 // Number of time measurements performed in a given network time calculation.
28 const int kNumTimeMeasurements = 5; 30 const int kNumTimeMeasurements = 5;
29 31
30 } // namespace 32 } // namespace
31 33
32 // static 34 // static
33 void NetworkTimeTracker::RegisterPrefs(PrefRegistrySimple* registry) { 35 void NetworkTimeTracker::RegisterPrefs(PrefRegistrySimple* registry) {
34 registry->RegisterDictionaryPref(prefs::kNetworkTimeMapping, 36 registry->RegisterDictionaryPref(prefs::kNetworkTimeMapping,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (network_time_.is_null()) 118 if (network_time_.is_null())
117 return false; 119 return false;
118 DCHECK(!network_time_ticks_.is_null()); 120 DCHECK(!network_time_ticks_.is_null());
119 *network_time = network_time_ + (time_ticks - network_time_ticks_); 121 *network_time = network_time_ + (time_ticks - network_time_ticks_);
120 if (uncertainty) 122 if (uncertainty)
121 *uncertainty = network_time_uncertainty_; 123 *uncertainty = network_time_uncertainty_;
122 return true; 124 return true;
123 } 125 }
124 126
125 } // namespace network_time 127 } // 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