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

jde_utc_days Error #261

Closed
adcl-0 opened this issue Nov 27, 2023 · 6 comments · Fixed by #303
Closed

jde_utc_days Error #261

adcl-0 opened this issue Nov 27, 2023 · 6 comments · Fixed by #303

Comments

@adcl-0
Copy link

adcl-0 commented Nov 27, 2023

if I create Epoch for dates of 2023 the represantation of date when printed is okay and the jde_utc is also correct.
but when I do that same for dates of year 1608 the representation of dates is wrong but jde calculation is still correct.
but as soon as i try the same for years 1607 and before both the jde calculation as well as the date representation is wrong.
is it a bug or something I am not able to understand.

I haven't tried the python library I just tried the rust
Thanks
Following is an example code and the result :

use hifitime;

pub fn jde_test() {
    let mut test: hifitime::Epoch;
    println!("Dates and JDE for year 1607");
    for i in 25..=31 {
        test = hifitime::Epoch::from_gregorian_utc(1607, 12, i, 0, 0, 0, 0);
        println!("{} - {}", test, test.to_jde_utc_days());
    }
    println!("Dates and JDE for year 1608");
    for i in 1..=5 {
        test = hifitime::Epoch::from_gregorian_utc(1608, 1, i, 0, 0, 0, 0);
        println!("{} - {}", test, test.to_jde_utc_days());
    }
    println!("Dates and JDE for year 2023");
    for i in 1..=5 {
        test = hifitime::Epoch::from_gregorian_utc(2023, 1, i, 0, 0, 0, 0);
        println!("{} - {}", test, test.to_jde_utc_days());
    }
}
Dates and JDE for year 1607
-3277145-01-01T00:00:00 UTC - -1194435819.5
-3277145-01-01T00:00:00 UTC - -1194435818.5
-3277145-01-01T00:00:00 UTC - -1194435817.5
-3277145-01-01T00:00:00 UTC - -1194435816.5
-3277145-01-01T00:00:00 UTC - -1194435815.5
-3277145-01-01T00:00:00 UTC - -1194435814.5
-3277145-01-01T00:00:00 UTC - -1194435813.5
Dates and JDE for year 1608
1592-01-01T00:00:00 UTC - 2308369.5
1592-01-01T00:00:00 UTC - 2308370.5
1592-01-01T00:00:00 UTC - 2308371.5
1592-01-01T00:00:00 UTC - 2308372.5
1592-01-01T00:00:00 UTC - 2308373.5
Dates and JDE for year 2023
2023-01-01T00:00:00 UTC - 2459945.5
2023-01-02T00:00:00 UTC - 2459946.5
2023-01-03T00:00:00 UTC - 2459947.5
2023-01-04T00:00:00 UTC - 2459948.5
2023-01-05T00:00:00 UTC - 2459949.5
@ChristopherRabotin
Copy link
Member

ChristopherRabotin commented Nov 27, 2023 via email

@adcl-0
Copy link
Author

adcl-0 commented Nov 27, 2023

Fix it as soon as you can please.
Thanks

@ChristopherRabotin
Copy link
Member

ChristopherRabotin commented Nov 27, 2023 via email

@adcl-0
Copy link
Author

adcl-0 commented Nov 27, 2023

for now I am using my own calculations for jde and sidereal times, I need these to calculate nutation and precession mainly.
Calendar representation is not a biggie for me. I just reported it coz it was there
let me check if TAI etc. are also affected and i will let you know tomorrow

ChristopherRabotin added a commit that referenced this issue Dec 1, 2023
When it's about to overflow, we would immediately set the duration to MIN or MAX. But in fact, we can try to convert everything to i128 and then see if it fits in the duration.

Add test for #261 (does not pass yet)
@ChristopherRabotin
Copy link
Member

Just to let you know, I've started working on this. I've fixed the negative years you were seeing, but the computed years is still incorrect.

@ChristopherRabotin
Copy link
Member

With the large update done in preparation to version 4, the years and month seem correct for the year 1607, but not the days, so I'm working on that.

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

Successfully merging a pull request may close this issue.

2 participants