OLD | NEW |
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 <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/prefs/pref_registry_simple.h" | |
13 #include "base/prefs/pref_service.h" | |
14 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
16 #include "build/build_config.h" | 14 #include "build/build_config.h" |
17 #include "components/network_time/network_time_pref_names.h" | 15 #include "components/network_time/network_time_pref_names.h" |
| 16 #include "components/prefs/pref_registry_simple.h" |
| 17 #include "components/prefs/pref_service.h" |
18 | 18 |
19 namespace network_time { | 19 namespace network_time { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // Clock resolution is platform dependent. | 23 // Clock resolution is platform dependent. |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
25 const int64_t kTicksResolutionMs = base::Time::kMinLowResolutionThresholdMs; | 25 const int64_t kTicksResolutionMs = base::Time::kMinLowResolutionThresholdMs; |
26 #else | 26 #else |
27 const int64_t kTicksResolutionMs = 1; // Assume 1ms for non-windows platforms. | 27 const int64_t kTicksResolutionMs = 1; // Assume 1ms for non-windows platforms. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (network_time_.is_null()) | 119 if (network_time_.is_null()) |
120 return false; | 120 return false; |
121 DCHECK(!network_time_ticks_.is_null()); | 121 DCHECK(!network_time_ticks_.is_null()); |
122 *network_time = network_time_ + (time_ticks - network_time_ticks_); | 122 *network_time = network_time_ + (time_ticks - network_time_ticks_); |
123 if (uncertainty) | 123 if (uncertainty) |
124 *uncertainty = network_time_uncertainty_; | 124 *uncertainty = network_time_uncertainty_; |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 } // namespace network_time | 128 } // namespace network_time |
OLD | NEW |