-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
MJD/JDE UTC fix + to_time_scale
now available in Python
#332
Conversation
…er have to change it again
src/epoch/mod.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes here are for the initializers that were moved to initializers.rs
.
|
||
#[must_use] | ||
pub fn from_mjd_utc(days: f64) -> Self { | ||
Self::from_mjd_in_time_scale(days, TimeScale::UTC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function previously called from_mjd_tai
and then manually applied the leap seconds. Now it calls the from_mjd_in_time_scale
function which correctly sets the time scale without changing the duration.
|
||
#[must_use] | ||
pub fn from_jde_utc(days: f64) -> Self { | ||
Self::from_jde_in_time_scale(days, TimeScale::UTC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The from_jde_utc
function has the same bug as in #302 , so I've done the same fix.
@@ -2069,11 +2069,17 @@ fn regression_test_gh_282() { | |||
fn regression_test_gh_288() { | |||
use core::str::FromStr; | |||
let epoch = Epoch::from_str("2021-03-06 11:14:40.9960 GPST").unwrap(); | |||
let epoch_from_gpst = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional test for #257 .
@@ -2137,3 +2143,32 @@ fn regression_test_gh_317() { | |||
nanos | |||
); | |||
} | |||
|
|||
#[test] | |||
fn regression_test_gh_302() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New regression test for #302 .
@@ -25,6 +25,9 @@ def test_strtime(): | |||
print(f"caught {e}") | |||
else: | |||
raise AssertionError("failed to catch parsing error") | |||
|
|||
epoch_tdb = epoch.to_time_scale(TimeScale.TDB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a Python test for #331.
Closes #331
Closes #257
Closes #302
This also makes #229 much easier to get started on. My only hesitation with that ticket is that in Python, we use
init_from_unix_seconds
a lot and we're launching in a few weeks so I'm hesitant to change my habits this close to launch.