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

Prevent rounding of the GNSS from nanoseconds initializers #319

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

ChristopherRabotin
Copy link
Member

@ChristopherRabotin ChristopherRabotin commented Jul 22, 2024

This issue was due to the from_{GNSS}_nanoseconds functions which would round the input nanoseconds from a u64 into an f64. Now we initialize all GNSS time scales using the Duration's from_parts function such that if a duration fits in nanoseconds u64 (i.e. is less than ~4.1 centuries long), then it will be "normalized" and initialized in this time scale.

I added tests to confirm that this fix works for a recent-ish GPST nanoseconds. I could not add tests for any nanoseconds initialization which is more than one century away because the to_{GNSS}_nanoseconds functions return an error if the centuries is non zero (as documented).

Closes #317

@ChristopherRabotin ChristopherRabotin merged commit 18c8471 into master Jul 22, 2024
28 checks passed
@ChristopherRabotin ChristopherRabotin deleted the 317-gpst-roundtrip branch July 23, 2024 15:51
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.

Roundtrip to/from gpst_nanoseconds are not equal.
1 participant