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

Make unixtimestamp behave the same as System.currentTimeMillis() #755

Merged
merged 2 commits into from
Sep 27, 2021

Conversation

jmaroeder
Copy link
Contributor

We are using Math.round() to determine the number of milliseconds to add to the epoch second in unixtimestamp, but System.currentTimeMillis() uses floor division, not rounding. This can lead to rare instances where the value of unixtimestamp() is greater than the value of System.currentTimeMillis().

By removing the rounding and just using integer division, we should avoid that situation.

@jmaroeder jmaroeder merged commit 40eb176 into master Sep 27, 2021
@jmaroeder jmaroeder deleted the more-consistent-unixtimestamp branch September 27, 2021 15:16
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.

2 participants