Skip to main content

Module time

Module time 

Source
Expand description

Time scales: Julian dates, FITS DATE-OBS strings, Julian epochs, and sidereal time.

Provenance: parse_date_obs / format_date_obs are extracted from fits-header (src/dates.rs); the MJD/JD conversions and gmst / lst are written fresh, validated against Meeus, Astronomical Algorithms 2nd ed. (chapters 7 and 12).

GMST uses the IAU-1982 polynomial (Meeus eq. 12.4) on the UT1 ≈ UTC assumption: |ΔUT1| < 0.9 s of time ≈ 13.5″ of hour angle, inside the crate’s planning-grade contract. Functions taking OffsetDateTime convert to UTC internally, so passing local civil time cannot skew sidereal results. JD/MJD are carried as f64 — microsecond-level resolution in the current era.

Functions§

datetime_to_mjd
Modified Julian Date of a timezone-naive instant (taken as UTC). Inverse of mjd_to_datetime.
format_date_obs
Format a date/time back to the FITS civil form (YYYY-MM-DDThh:mm:ss[.fff]), dropping a zero sub-second part. Inverse of parse_date_obs.
gmst
Greenwich Mean Sidereal Time, normalized to [0h, 24h). Feeds lst at an observer’s longitude.
jd_to_mjd
Convert a Julian Date to a Modified Julian Date. Inverse of mjd_to_jd.
julian_date
Julian Date of an instant; the offset is folded in (UTC internally).
julian_epoch_of
The Julian epoch of an instant, e.g. Epoch::OfDate(2026.52…) for mid-July 2026. Feeds precess when moving an Equatorial position to “tonight”.
lst
Local Sidereal Time at an east-positive longitude, normalized to [0h, 24h). lst(at, lon) == gmst(at) + lon (wrapped).
mjd_to_datetime
Timezone-naive UTC instant of a Modified Julian Date. Inverse of datetime_to_mjd.
mjd_to_jd
Convert a Modified Julian Date to a Julian Date. Inverse of jd_to_mjd.
parse_date_obs
Parse a FITS civil date/time (YYYY-MM-DD[Thh:mm:ss[.fff]]), timezone-naive; a date-only value means midnight. Quoted card values and surrounding whitespace are tolerated. FITS strings carry no offset — bridge to OffsetDateTime with parse_date_obs(s)?.assume_utc(). Inverse of format_date_obs.