Repository navigation
Handle TT2000 leap seconds and adjust unixtime mapping - #350
Merged
Merged
Conversation
breakdown_tt2000 carried a rolled-over second into the minute field, so 2016-12-31T23:59:60 came back as 23:60:00, which datetime rejects. The 31st-of-month style carry is dropped: the CDF library renders leap seconds as second 60, and compute_tt2000 already accepts that. _LeapSecondsfromJ2000 flagged the overflow bit for every value at or past the next leap boundary rather than only the leap second itself. When a scalar was broken down the loop broke early and the bit stayed clear, so array input returned a different (broken) result than scalar input for the same value. Restrict the flag to values assigned to that interval. unixtime() now maps :60 to :59 plus one second, as unix time has no leap seconds.
Break down TT2000 leap seconds as :59:60 and make unixtime handle them
There was a problem hiding this comment.
🔵 Needs a closer look
Leap-second boundary behavior still needs runtime regression validation before approval.
No open issues 🎉
What changed in this PR
Corrects leap-second handling in cdflib’s TT2000 conversions and Unix timestamp mapping.
Changes:
- Preserves leap seconds as
23:59:60during TT2000 breakdown. - Restricts leap-second detection to the applicable interval and maps leap seconds to the following Unix second.
- Adds regression tests for scalar/array consistency, round-tripping, encoding, and Unix timestamps.
| File | Description |
|---|---|
| tests/test_epochs.py | Adds leap-second conversion regression tests. |
| cdflib/epochs.py | Corrects TT2000 breakdown and Unix timestamp mapping. |
Review effort: Balanced
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
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.
No description provided.