Skip to content

Fix loss of precision when converting a JS timestamp object to uint64_t#11

Merged
JosephusPaye merged 1 commit into
mainfrom
paye/fix_timestamp_conversion
Feb 29, 2024
Merged

Fix loss of precision when converting a JS timestamp object to uint64_t#11
JosephusPaye merged 1 commit into
mainfrom
paye/fix_timestamp_conversion

Conversation

@JosephusPaye
Copy link
Copy Markdown
Collaborator

The conversion of a JS timestamp object of nanos and seconds to a single uint64_t value currently uses 1e9 as a multiplier. This causes the conversion to be done with doubles, with the result implicitly converted to a uint64_t, leading to a loss of precision in certain cases.

This PR uses the literal 1000000000L instead of the scientific notation, ensuring the conversion is done with integers.

@JosephusPaye JosephusPaye merged commit 47f52f4 into main Feb 29, 2024
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