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

fix rounding of time to milliseconds #5352

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:
The current implementation of RoundToMilliseconds is broken due to improper handling of floating-point operation in go.
See
image

This PR fixes it by using simple division and modulo operators

Checklist

  • Tests updated

Current implementation of RoundToMilliseconds is broken due to improper handling of floating point operation in go.
Fixing it by using simple division and modulo operators
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

Nice find! LGTM

Copy link
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

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

Nice 👌🏻 curious how did you find this?

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

lgtm

@owen-d owen-d merged commit 0afd113 into grafana:main Feb 9, 2022
dannykopping pushed a commit that referenced this pull request Feb 10, 2022
Current implementation of RoundToMilliseconds is broken due to improper handling of floating point operation in go.
Fixing it by using simple division and modulo operators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants