Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2018

Conversation

zpencer
Copy link
Contributor

@zpencer zpencer commented Sep 26, 2018

We should reflect changes in the system clock.

We should reflect changes in the system clock.
@Override
public long currentTimeNanos() {
return System.nanoTime() + offsetNanos;
return TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
}
Copy link
Member

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
Member

@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