Skip to content

Commit 777bbbb

Browse files
authored
core: TimeProvider should not assume that the clock never changes (#4883)
We should reflect changes in the system clock.
1 parent 6b15aa9 commit 777bbbb

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

core/src/main/java/io/grpc/internal/TimeProvider.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@ public interface TimeProvider {
2727
long currentTimeNanos();
2828

2929
TimeProvider SYSTEM_TIME_PROVIDER = new TimeProvider() {
30-
final long offsetNanos =
31-
TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()) - System.nanoTime();
32-
3330
@Override
3431
public long currentTimeNanos() {
35-
return System.nanoTime() + offsetNanos;
32+
return TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
3633
}
3734
};
3835
}

0 commit comments

Comments
 (0)