core: TimeProvider should not assume that the clock never changes (#4883)

We should reflect changes in the system clock.
This commit is contained in:
zpencer 2018-11-20 11:34:58 -08:00 committed by GitHub
parent 6b15aa9e4e
commit 777bbbb121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -27,12 +27,9 @@ public interface TimeProvider {
long currentTimeNanos();
TimeProvider SYSTEM_TIME_PROVIDER = new TimeProvider() {
final long offsetNanos =
TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()) - System.nanoTime();
@Override
public long currentTimeNanos() {
return System.nanoTime() + offsetNanos;
return TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
}
};
}