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

Allow to ignore leap seconds after a given date #43

Closed
ChristopherRabotin opened this issue Aug 1, 2019 · 4 comments · Fixed by #194
Closed

Allow to ignore leap seconds after a given date #43

ChristopherRabotin opened this issue Aug 1, 2019 · 4 comments · Fixed by #194
Assignees

Comments

@ChristopherRabotin
Copy link
Member

This is important as some simulation systems might not include all of the leap seconds. This is needed for validation of astrodynamics computations.

@ChristopherRabotin
Copy link
Member Author

This is likely possible with a crate feature system: all of the leap seconds are enabled by default, but one could build hifitime without specific leap seconds. However, I would need to update the test suite so that "no default feature" doesn't disable all of the leap seconds.

@ChristopherRabotin
Copy link
Member Author

One way to support this is to allow providing a structure that reads the IERS Leap Seconds file. Then, one could create an epoch from that context. The best would be for that Epoch to be created with the same constructors, but I don't know whether that is possible because that would require an associated type to Epoch, and I don't think I could build one that reads a file (unless that file is read a compile time, but that's what we're trying to avoid here).

If a solution is found, then this should also be used for the UT1 computation.

@ChristopherRabotin
Copy link
Member Author

@cjordan If you have any idea on how I could implement an input file to read the data from, that would be great because the same method could be used to read from the EOP data.

Looking at the code, it seems like the LEAP_SECONDS constant is only used in the leap_seconds(&self, iers_only: bool) function.

So I think that a new function could be created like: leap_seconds_with::<L: LeapSecondProvider>(&self, iers_only: bool) and the current const LEAP_SECONDS would implement that trait. Every function that uses the leap second calculation would be renamed from blah_blah to blah_blah_with so that the current functions stay as an implementation with the const leap seconds.

Then, I'd build another implementation of the LeapSecondProvider that reads from the leap seconds list published by the IERS.

The same method should also work for support UT1, I think...

latest_eop2.short.txt
leap-seconds.list.txt

@cjordan
Copy link
Contributor

cjordan commented Oct 25, 2022

Sorry for the delay, it's been a busy few days.

I think your proposal makes sense. It would be useful to have the flexibility of defining your own "leap second provider". I guess my only concern would be how it affects existing users and "simple" usage of hifitime; do you envision all Epoch-creating functions requiring a leap second provider? I wonder if that is a step too far, and the existing functions/methods are kept in place with a new mechanism to get the leap seconds in. Maybe some kind of EpochBuilder? Sorry if this isn't really helpful! Just thinking out loud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants