pg_orrery/src/sidereal_time.h
Ryan Malloy 3915d1784f Rename pg_orbit to pg_orrery
An existing product called PG Orbit (a mobile PostgreSQL client)
creates a naming conflict. pg_orrery — a database orrery built from
Keplerian parameters and SQL instead of brass gears.

Build system: control file, Makefile, Dockerfile, docker init script.
C source: GUC prefix, PG_FUNCTION_INFO_V1 symbol, header guards,
ereport prefixes, comments across ~30 files including vendored SGP4.
SQL: all 5 install/migration scripts, function name pg_orrery_ephemeris_info.
Tests: 9 SQL suites, 8 expected outputs, standalone DE reader test.
Documentation: CLAUDE.md, README.md, DESIGN.md, Starlight site infra,
36 MDX pages, OG renderer, logo SVG, docker-compose, agent threads.

All 13 regression suites pass. Docs site builds (37 pages).
2026-02-17 13:36:22 -07:00

48 lines
1.5 KiB
C

/*
* sidereal_time.h -- Greenwich sidereal time (mean and apparent)
*
* Clean-room implementation from published standards:
* IERS Conventions (2010), IERS Technical Note 36, Ch. 5.
* Capitaine, Guinot & McCarthy (2000), "Definition of the
* Celestial Ephemeris Origin and of UT1 in the International
* Celestial Reference Frame", A&A 355, 398-405.
*
* No PostgreSQL dependencies -- pure math, suitable for standalone use.
*/
#ifndef PG_ORRERY_SIDEREAL_TIME_H
#define PG_ORRERY_SIDEREAL_TIME_H
/*
* get_mean_sidereal_time -- Greenwich Mean Sidereal Time
*
* Computes GMST using the classical polynomial in UT1,
* consistent with IAU 2006 precession.
*
* JD = Julian Date (UT1 timescale)
* JDE = Julian Ephemeris Date (TDB/TT timescale)
*
* For pg_orrery Phase 2, JD and JDE are treated as identical
* (delta-T correction not yet applied; the difference is <1s
* for recent epochs).
*
* Returns GMST in radians, normalized to [0, 2*pi).
*/
double get_mean_sidereal_time(double JD, double JDE);
/*
* get_apparent_sidereal_time -- Greenwich Apparent Sidereal Time
*
* GAST = GMST + equation of the equinoxes.
*
* The equation of the equinoxes accounts for nutation:
* EqEq = delta_psi * cos(epsilon_A)
* where delta_psi is nutation in longitude and epsilon_A is
* the mean obliquity, both from precession.h.
*
* Returns GAST in radians, normalized to [0, 2*pi).
*/
double get_apparent_sidereal_time(double JD, double JDE);
#endif /* PG_ORRERY_SIDEREAL_TIME_H */