Skip to content

Time Scales

STKCraft edited this page Nov 12, 2026 · 1 revision

Time scales

This page states the definition used by the crate for every scale it exposes, and where that definition comes from. The formulas are the ones in src/convert.rs, src/dtdb.rs, src/tdb.rs and src/coord.rs.

Internal representation

An epoch is stored as

Epoch = (i64 TAI seconds, u32 nanoseconds) since 2000-01-01T00:00:00 TAI

TAI has no leap seconds, so this representation is monotonic and suitable for arithmetic. UTC, TT, TDB and the coordinate scales are derived, never stored. The nanosecond field is a representation step, not a claim of nanosecond accuracy.

The scales

Scale Definition in this crate Origin
TAI Continuous atomic time 2000-01-01T00:00:00 TAI
UTC Civil time with leap seconds, from the LSK calendar
TT TAI + DELTET/DELTA_T_A (nominal 32.184 s) J2000 TT
ET (NAIF) TT + K*sin(E), E = M + EB*sin(M), M = M0 + M1*t 2000-01-01T12:00:00 TDB
TDB (compact) TT + 0.001658*sin(g) + 0.000014*sin(2g) J2000 TDB
TDB (IAU) TT + 787-term Fairhead & Bretagnon series J2000 TDB
GPS TAI - 19 s, zero at 1980-01-06T00:00:00 UTC GPS epoch
UT1 TAI + (UT1 - UTC) - (TAI - UTC), from an IERS EOP table 2000-01-01T00:00:00 UT1
TCG TT + L_G/(1-L_G)*(JD_TT - T0)*86400 JD 2451545.0 on TCG
TCB TDB + (L_B*(JD_TDB - T0)*86400 - TDB0)/(1-L_B) JD 2451545.0 on TCB

The constants are read from the LSK where the LSK defines them: DELTET/DELTA_T_A, DELTET/K, DELTET/EB, DELTET/M. The nominal values are 32.184, 1.657e-3, 1.671e-2, 6.239996 and 1.99096871e-7.

The IAU constants are used as published: L_G = 6.969290134e-10, L_B = 1.550519768e-8, TDB0 = -6.55e-5 s, and T0 = 1977-01-01T00:00:00 TAI expressed as JD 2443144.5003725 in TT.

Seconds past which origin

  • tai_seconds() and Epoch count from 2000-01-01T00:00:00 TAI.
  • tai_to_tt and tai_to_tdb_iau return seconds past JD 2451545.0 on their own scale, i.e. they are zero at the corresponding 2000-01-01T12:00:00.
  • tai_to_et returns NAIF ET: TDB seconds past 2000-01-01T12:00:00 TDB, the SPICE convention.
  • tai_to_gps is zero at 1980-01-06T00:00:00 UTC.
  • tai_to_ut1 is zero at the UT1 instant labelled 2000-01-01T00:00:00.
  • TCG and TCB are seconds past JD 2451545.0 on their own scale, so they are not numerically equal to TT/TDB at that instant. At the physical J2000 TT instant, TCG reads about +0.5058 s because TCG runs faster than TT.

UTC is a representation, not a stored scale

UtcDateTime holds year, month, day, hour, minute, second. The calendar those fields belong to is supplied to each conversion call, so a Julian date and a Gregorian date with the same fields are different instants. Conversions validate the fields against the selected calendar and against the LSK:

  • 23:59:60.x is legal only on a UTC day that the LSK declares as 86 401 seconds long.
  • 23:59:59.x does not exist on a 86 399-second day; it returns InvalidLeapSecond instead of aliasing the next day's 00:00:00.
  • The day length is derived from the leap-second table, never assumed.

See Leap seconds and the LSK for the full rules.

Which scale to use

Goal Use
Interoperate with SPICE products, CK/SPK time tags ET (convert::tai_to_et)
Compare with ERFA/SOFA or relativistic pipelines dtdb::tai_to_tdb_iau, coord::*
Hand a time to a chrono/time/std API UtcDateTime
Spacecraft telemetry type-1 SCLK (SCLK)
Earth rotation, sidereal time input UT1 (UT1 and EOP)
GNSS receivers GPS seconds
Avoid leap seconds in arithmetic Epoch (TAI) or Duration

ET, the compact TDB approximation and the IAU TDB series are different functions, not interchangeable spellings. See TDB models.

Representation limits

  • f64 seconds near 5e8 (modern ET) have a spacing of about 60 ns. That is the resolution of the value, not its accuracy.
  • ET is an f64 by definition in SPICE, so the same limit applies to CSPICE.
  • Epoch is exact in nanoseconds as long as the result fits in i64 seconds; the infallible constructors panic rather than wrap, and checked_* variants return None.

References

  • NAIF, SPICE Time Subsystem Required Reading (time.req).
  • IAU 2000/2006 resolutions for TCG/TCB (L_G, L_B, TDB0).
  • IERS Conventions, chapter 5, for UT1 and EOP definitions.

Clone this wiki locally