Epoch conversions shared by the GNSS correction wrappers.
These helpers turn an Elixir NaiveDateTime or a
{{year, month, day}, {hour, minute, second}} tuple into the two
representations the astrodynamics-gnss crate consumes:
- a split Julian date
{jd_whole, fraction}wherejd_wholeis the*.5midnight boundary of the civil day andfractionis the within-day part (the same convention the SP3 reader uses); - integer seconds since the J2000 epoch (JD 2451545.0), used by the IONEX slant-delay API so the query lands exactly on the product's own epoch axis with no float-rounded time entering the temporal bracket.
No leap-second shifting is applied: the epoch stays in the time scale the caller supplied it in (typically GPS time for these models).
Summary
Functions
Fractional day-of-year of the epoch, as the float the Niell troposphere
seasonal term consumes.
Convert an epoch to integer seconds since the J2000 epoch (JD 2451545.0).
Convert an epoch to the split Julian date {jd_whole, fraction}.
Seconds-of-day in [0, 86400), formed from the epoch's integer clock fields.
Functions
@spec day_of_year(NaiveDateTime.t() | tuple()) :: float()
Fractional day-of-year of the epoch, as the float the Niell troposphere
seasonal term consumes.
January 1 00:00 is 1.0. The value is the integer civil day-of-year plus the
within-day fraction (the continuous day-of-year), matching the crate's
fractional SolveInputs.day_of_year convention and the standalone
troposphere recipe, so the SPP troposphere and Orbis.Troposphere agree for
the same epoch.
@spec epoch_to_j2000_seconds(NaiveDateTime.t() | tuple()) :: {:ok, integer()} | {:error, term()}
Convert an epoch to integer seconds since the J2000 epoch (JD 2451545.0).
The seconds-of-day are formed from the integer clock fields, so a whole-second
epoch yields an exact integer. Returns {:ok, seconds} or
{:error, :non_integer_second_epoch} if the result is not an integer number
of seconds.
@spec epoch_to_split_jd(NaiveDateTime.t() | tuple()) :: {float(), float()}
Convert an epoch to the split Julian date {jd_whole, fraction}.
@spec second_of_day(NaiveDateTime.t() | tuple()) :: float()
Seconds-of-day in [0, 86400), formed from the epoch's integer clock fields.
Used by the Klobuchar diurnal term, which takes the GPS second-of-day
directly. Forming it from hour, minute, and second keeps it exact (no
split-Julian-date round trip), so the broadcast-model result is bit-for-bit
identical to the reference.