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

Fix tt2tdb() period and improve precision #35

Merged
merged 2 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/novas.c
Original file line number Diff line number Diff line change
Expand Up @@ -5178,9 +5178,14 @@ int tdb2tt(double jd_tdb, double *jd_tt, double *secdiff) {
* Returns the TDB - TT time difference in seconds for a given TT date.
*
*
* Note, as of version 1.1, it uses the same calculation as the more precise original tdb2tt().
*
*
* REFERENCES
* <ol>
* <li><a><href="https://gssc.esa.int/navipedia/index.php/Transformations_between_Time_Systems">
* <li><a href="https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/time.html#The%20Relationship%20between%20TT%20and%20TDB">
* https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/time.html</a>
* <li><a href="https://gssc.esa.int/navipedia/index.php/Transformations_between_Time_Systems">
* https://gssc.esa.int/navipedia/index.php/Transformations_between_Time_Systems</a>
* </li>
* </ol>
Expand All @@ -5194,9 +5199,16 @@ int tdb2tt(double jd_tdb, double *jd_tt, double *secdiff) {
* @author Attila Kovacs
*/
double tt2tdb(double jd_tt) {
double dt;

tdb2tt(jd_tt, NULL, &dt);
return dt;

/*
const double t = (jd_tt - JD_J2000) / JULIAN_CENTURY_DAYS;
const double g = TWOPI * (357.528 + 35999.050 * t) * DEGREE;
return 0.001658 * sin(g + 0.0167 * sin(g));
const double g = 6.239996 + 630.0221385924 * t;
return 0.001657 * sin(g + 0.01671 * sin(g));
*/
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/reference/rad_vel.out
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@

-10000.0 SUN S0 O1 A1: -23.440742

-10000.0 SUN S0 O2 A1: 14.828582
-10000.0 SUN S0 O2 A1: 14.828581

-10000.0 EARTH S0 O0 A1: -0.246770

Expand Down