Skip to content

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

Merged
zpencer merged 1 commit intogrpc:masterfrom
zpencer:fix-timeprovider-clock-change
Nov 20, 2018
Merged

core: TimeProvider should not assume that the clock never changes#4883
zpencer merged 1 commit intogrpc:masterfrom
zpencer:fix-timeprovider-clock-change

Conversation

@zpencer
Copy link
Copy Markdown
Contributor

@zpencer zpencer commented Sep 26, 2018

We should reflect changes in the system clock.

We should reflect changes in the system clock.
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.

Copy link
Copy Markdown
Contributor

@dapengzhang0 dapengzhang0 left a comment

Choose a reason for hiding this comment

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

LGTM
We can merge this first and fix #5056 later.

@zpencer zpencer merged commit 777bbbb into grpc:master Nov 20, 2018
@zpencer zpencer deleted the fix-timeprovider-clock-change branch November 20, 2018 19:35
@lock lock bot locked as resolved and limited conversation to collaborators Feb 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants