Prevent rounding of the GNSS from nanoseconds initializers #319
Add this suggestion to a batch that can be applied as a single commit.
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.
Add this suggestion to a batch that can be applied as a single commit.
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.
Suggestion cannot be applied right now. Please check back later.
This issue was due to the
from_{GNSS}_nanoseconds
functions which would round the input nanoseconds from au64
into anf64
. Now we initialize all GNSS time scales using the Duration'sfrom_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