nyx-space / hifitime

A high fidelity time management library in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jde_utc_days Error

adcl-0 opened this issue · comments

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

Fix it as soon as you can please.
Thanks

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

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.

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.