MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / sidtime_long_term

Function sidtime_long_term

swephlib.cpp:3290–3329  ·  view source on GitHub ↗

* The time range of DE431 requires a new calculation of sidereal time that * gives sensible results for the remote past and future. * The algorithm is based on the formula of the mean earth by Simon & alii, * "Precession formulae and mean elements for the Moon and the Planets", * A&A 282 (1994), p. 675/678. * The longitude of the mean earth relative to the mean equinox J2000 * is calc

Source from the content-addressed store, hash-verified

3288/*#define SIDT_LTERM TRUE
3289#if SIDT_LTERM*/
3290static double sidtime_long_term(double tjd_ut, double eps, double nut)
3291{
3292 double tsid = 0, tjd_et;
3293 double dlon, xs[6], xobl[6], dhour, nutlo[2];
3294 double dlt = AUNIT / CLIGHT / 86400.0;
3295 double t, t2, t3;
3296 tjd_et = tjd_ut + swe_deltat_ex(tjd_ut, -1, NULL);
3297 t = (tjd_et - J2000) / 365250.0;
3298 t2 = t * t; t3 = t * t2;
3299 /* mean longitude of earth J2000 */
3300 dlon = 100.46645683 + (1295977422.83429 * t - 2.04411 * t2 - 0.00523 * t3) / 3600.0;
3301 /* light time sun-earth */
3302 dlon = swe_degnorm(dlon - dlt * 360.0 / 365.2425);
3303 xs[0] = dlon * DEGTORAD; xs[1] = 0; xs[2] = 1;
3304 /* to mean equator J2000, cartesian */
3305 xobl[0] = 23.45; xobl[1] = 23.45;
3306 xobl[1] = swi_epsiln(J2000 + swe_deltat_ex(J2000, -1, NULL), 0) * RADTODEG;
3307 swi_polcart(xs, xs);
3308 swi_coortrf(xs, xs, -xobl[1] * DEGTORAD);
3309 /* precess to mean equinox of date */
3310 swi_precess(xs, tjd_et, 0, -1);
3311 /* to mean equinox of date */
3312 xobl[1] = swi_epsiln(tjd_et, 0) * RADTODEG;
3313 swi_nutation(tjd_et, 0, nutlo);
3314 xobl[0] = xobl[1] + nutlo[1] * RADTODEG;
3315 xobl[2] = nutlo[0] * RADTODEG;
3316 swi_coortrf(xs, xs, xobl[1] * DEGTORAD);
3317 swi_cartpol(xs, xs);
3318 xs[0] *= RADTODEG;
3319 dhour = fmod(tjd_ut - 0.5, 1) * 360;
3320 /* mean to true (if nut != 0) */
3321 if (eps == 0)
3322 xs[0] += xobl[2] * cos(xobl[0] * DEGTORAD);
3323 else
3324 xs[0] += nut * cos(eps * DEGTORAD);
3325 /* add hour */
3326 xs[0] = swe_degnorm(xs[0] + dhour);
3327 tsid = xs[0] / 15;
3328 return tsid;
3329}
3330/*#endif*/
3331
3332/* Apparent Sidereal Time at Greenwich with equation of the equinoxes

Callers 1

swe_sidtime0Function · 0.85

Calls 8

swe_deltat_exFunction · 0.85
swe_degnormFunction · 0.85
swi_epsilnFunction · 0.85
swi_polcartFunction · 0.85
swi_coortrfFunction · 0.85
swi_precessFunction · 0.85
swi_nutationFunction · 0.85
swi_cartpolFunction · 0.85

Tested by

no test coverage detected