Skip to content

Prevent rounding of the GNSS from nanoseconds initializers#319

Merged
ChristopherRabotin merged 2 commits intomasterfrom
317-gpst-roundtrip
Jul 22, 2024
Merged

Prevent rounding of the GNSS from nanoseconds initializers#319
ChristopherRabotin merged 2 commits intomasterfrom
317-gpst-roundtrip

Conversation

@ChristopherRabotin
Copy link
Copy Markdown
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
@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