Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions core/src/main/java/io/grpc/internal/TimeProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After your change, it will return the same nano value for any invocation that happens within one millisecond.

};
}