Skip to content

Fix unnecessary early overflow in NewUTCSpliceTime, add tests #89

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

Merged
merged 2 commits into from
Mar 16, 2025

Conversation

julijane
Copy link
Contributor

@julijane julijane commented Mar 16, 2025

While looking through the code for functions/methods that maybe should have a test, I noticed that NewUTCSpliceTime overflows when the gpsepoch input plus the offset between unix epoch and gps epoch exceeds uint32. While this only happens in the year 2106 and it is questionable (but not ruled out 😬 ) that SCTE35 is still in use then, I found it wrong to leave it like that. Fixed that, now it works with all values for gpsepoch, which only overflows in the year 2116 when the range really ends (so roughly 10 years later). Also internally the time was not stored as UTC. While that probably makes no difference, I fixed that too.

The GPSSeconds method of UTCSpliceTime likewise had a overflow in the year 2106. Here it did not affect the result, as the subsequent subtraction in uint32 number space still resulted in the correct result, but again it felt wrong, to leave it like that.

Also added tests.

@julijane julijane requested a review from blahspam as a code owner March 16, 2025 20:34
@blahspam blahspam merged commit a53973e into Comcast:main Mar 16, 2025
2 checks passed
@julijane julijane deleted the juli/fix-gpstime-conversions branch March 17, 2025 17:49
@blahspam blahspam added the bug Something isn't working label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants