| Index: components/network_time/network_time_tracker.cc
|
| diff --git a/components/network_time/network_time_tracker.cc b/components/network_time/network_time_tracker.cc
|
| index 8c0540777e0e847154afa9faa2d341d5e7f18389..430140c5a45919e3d396b8643d68615a60245083 100644
|
| --- a/components/network_time/network_time_tracker.cc
|
| +++ b/components/network_time/network_time_tracker.cc
|
| @@ -306,12 +306,13 @@ base::TimeDelta NetworkTimeTracker::GetTimerDelayForTesting() const {
|
| return timer_.GetCurrentDelay();
|
| }
|
|
|
| -bool NetworkTimeTracker::GetNetworkTime(base::Time* network_time,
|
| - base::TimeDelta* uncertainty) const {
|
| +NetworkTimeTracker::NetworkTimeResult NetworkTimeTracker::GetNetworkTime(
|
| + base::Time* network_time,
|
| + base::TimeDelta* uncertainty) const {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(network_time);
|
| if (network_time_at_last_measurement_.is_null()) {
|
| - return false;
|
| + return NETWORK_TIME_NO_SYNC;
|
| }
|
| DCHECK(!ticks_at_last_measurement_.is_null());
|
| DCHECK(!time_at_last_measurement_.is_null());
|
| @@ -321,7 +322,7 @@ bool NetworkTimeTracker::GetNetworkTime(base::Time* network_time,
|
| if (time_delta.InMilliseconds() < 0) { // Has wall clock run backward?
|
| DVLOG(1) << "Discarding network time due to wall clock running backward";
|
| network_time_at_last_measurement_ = base::Time();
|
| - return false;
|
| + return NETWORK_TIME_SYNC_LOST;
|
| }
|
| // Now we know that both |tick_delta| and |time_delta| are positive.
|
| base::TimeDelta divergence = (tick_delta - time_delta).magnitude();
|
| @@ -330,13 +331,13 @@ bool NetworkTimeTracker::GetNetworkTime(base::Time* network_time,
|
| // reset.
|
| DVLOG(1) << "Discarding network time due to clocks diverging";
|
| network_time_at_last_measurement_ = base::Time();
|
| - return false;
|
| + return NETWORK_TIME_SYNC_LOST;
|
| }
|
| *network_time = network_time_at_last_measurement_ + tick_delta;
|
| if (uncertainty) {
|
| *uncertainty = network_time_uncertainty_ + divergence;
|
| }
|
| - return true;
|
| + return NETWORK_TIME_AVAILABLE;
|
| }
|
|
|
| void NetworkTimeTracker::CheckTime() {
|
| @@ -471,10 +472,10 @@ bool NetworkTimeTracker::ShouldIssueTimeQuery() {
|
| return false;
|
| }
|
|
|
| - // If GetNetworkTime() returns false, synchronization has been lost
|
| - // and a query is needed.
|
| + // If GetNetworkTime() does not return NETWORK_TIME_AVAILABLE,
|
| + // synchronization has been lost and a query is needed.
|
| base::Time network_time;
|
| - if (!GetNetworkTime(&network_time, nullptr)) {
|
| + if (GetNetworkTime(&network_time, nullptr) != NETWORK_TIME_AVAILABLE) {
|
| return true;
|
| }
|
|
|
|
|