Skip to content
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

Use nanoTime to compute delay time since first attempt #33

Merged
merged 1 commit into from
Jan 7, 2021

Conversation

sleberknight
Copy link
Member

This was (incorrectly) changed in the re-retrying fork to use
currentTimeMillis() instead of nanoTime() to make the delay computation
"simpler", but it resulted in a potentially problematic calculation
since nanoTime is intended to be used for elapsed time computations in
Java. Using currentTimeMillis can can odd issues (e.g. a call to
currentTimeMillis could return a number less than a preceding call
and thus result in a negative elapsed time)

Fixes #13

This was (incorrectly) changed in the re-retrying fork to use
currentTimeMillis() instead of nanoTime() to make the delay computation
"simpler", but it resulted in a potentially problematic calculation
since nanoTime is intended to be used for elapsed time computations in
Java. Using currentTimeMillis can can odd issues (e.g. a call to
currentTimeMillis could return a number less than a preceding call
and thus result in a negative elapsed time)

Fixes #13
@chrisrohr chrisrohr merged commit e6d14f8 into master Jan 7, 2021
@chrisrohr chrisrohr deleted the 13-use-nanoTime-for-elapsed-time branch January 7, 2021 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elapsed time calculations should use System.nanoTime()
2 participants