Chromium Code Reviews| Index: chrome/browser/metrics/variations/network_time_tracker.h |
| diff --git a/chrome/browser/metrics/variations/network_time_tracker.h b/chrome/browser/metrics/variations/network_time_tracker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ae18d9f3e444b029a94af8723470d6e4c1121241 |
| --- /dev/null |
| +++ b/chrome/browser/metrics/variations/network_time_tracker.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_METRICS_VARIATIONS_NETWORK_TIME_TRACKER_H_ |
| +#define CHROME_BROWSER_METRICS_VARIATIONS_NETWORK_TIME_TRACKER_H_ |
| + |
| +#include "base/time.h" |
| + |
| +class NetworkTimeTracker { |
|
Alexei Svitkine (slow)
2013/02/04 21:23:18
Nit: Add a short comment.
MAD
2013/02/05 01:05:55
Done.
|
| + public: |
| + NetworkTimeTracker(); |
| + virtual ~NetworkTimeTracker(); |
| + |
| + // Returns a network time based on values provided to UpdateNetworkTime and |
| + // CPU ticks count since then. Returns false if no network time is available |
| + // yet. Can also return the error range if |uncertainty| isn't NULL. |
| + bool GetNetworkTime(base::Time* network_time, |
| + base::TimeDelta* uncertainty) const; |
| + |
| + // The provided |network_time| is precise at the given |resolution| and |
| + // represent the time between now and up to |latency| ago. |
| + void UpdateNetworkTime(const base::Time& network_time, |
| + const base::TimeDelta& resolution, |
| + const base::TimeDelta& latency); |
| + |
| + private: |
| + // Remember the network time based on last call to UpdateNetworkTime(). |
| + base::Time network_time_; |
| + |
| + // 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.
|
| + base::TimeTicks network_time_ticks_; |
| + |
| + // Uncertainty of |network_time_| based on added inaccuracies/resolution. |
| + base::TimeDelta network_time_uncertainty_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_METRICS_VARIATIONS_NETWORK_TIME_TRACKER_H_ |