OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_NETWORK_TIME_TRACKER_H_ | |
6 #define CHROME_BROWSER_METRICS_VARIATIONS_NETWORK_TIME_TRACKER_H_ | |
7 | |
8 #include "base/time.h" | |
9 | |
10 class NetworkTimeTracker { | |
Alexei Svitkine (slow)
2013/02/04 21:23:18
Nit: Add a short comment.
MAD
2013/02/05 01:05:55
Done.
| |
11 public: | |
12 NetworkTimeTracker(); | |
13 virtual ~NetworkTimeTracker(); | |
14 | |
15 // Returns a network time based on values provided to UpdateNetworkTime and | |
16 // CPU ticks count since then. Returns false if no network time is available | |
17 // yet. Can also return the error range if |uncertainty| isn't NULL. | |
18 bool GetNetworkTime(base::Time* network_time, | |
19 base::TimeDelta* uncertainty) const; | |
20 | |
21 // The provided |network_time| is precise at the given |resolution| and | |
22 // represent the time between now and up to |latency| ago. | |
23 void UpdateNetworkTime(const base::Time& network_time, | |
24 const base::TimeDelta& resolution, | |
25 const base::TimeDelta& latency); | |
26 | |
27 private: | |
28 // Remember the network time based on last call to UpdateNetworkTime(). | |
29 base::Time network_time_; | |
30 | |
31 // The estimated ticks count when |network_time_| was set. | |
Alexei Svitkine (slow)
2013/02/04 21:23:18
Mention that this is relative to system time.
MAD
2013/02/05 01:05:55
Done.
| |
32 base::TimeTicks network_time_ticks_; | |
33 | |
34 // Uncertainty of |network_time_| based on added inaccuracies/resolution. | |
35 base::TimeDelta network_time_uncertainty_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker); | |
38 }; | |
39 | |
40 #endif // CHROME_BROWSER_METRICS_VARIATIONS_NETWORK_TIME_TRACKER_H_ | |
OLD | NEW |