{{ message }}
Avoid using floating points during timestamp-datetime conversions#591
Merged
methane merged 4 commits intoApr 19, 2024
Merged
Conversation
ThomasWaldmann
left a comment
Contributor
There was a problem hiding this comment.
LGTM, just a few nitpicks.
I assume that these tests fail without your changes?
Sorry, something went wrong.
Contributor
Author
|
Exactly, the tests i added except line 100 should fail without the changes. |
Sorry, something went wrong.
methane
requested changes
Apr 19, 2024
Member
|
thanks |
Sorry, something went wrong.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.
Right now, when we convert timestamp to datetime or datetime to timestamp, the library uses floating points to do the conversion. This introduces losses during the conversion as the datetime and timestamp datatypes do not support the same precision(nanoseconds).
For instance if we have a timestamp such as:
2024-04-16 08:43:09.420317+00:00with the current implementation the nanoseconds in the resulting
Timestampobject has420316934while it should be420317000instead.or in this timestamp:
2024-04-16 08:43:09.400000+00:00it has
400000095nanoseconds instead of400000000.