Expand description
Time scale conversions between astronomical time systems.
This module provides traits and implementations for converting between the eight major astronomical time scales: GPS, TAI, TT, TCG, TCB, TDB, UT1, and UTC.
§Time Scale Overview
| Scale | Full Name | Basis | Primary Use |
|---|---|---|---|
| UTC | Coordinated Universal Time | Atomic + leap seconds | Civil timekeeping |
| TAI | International Atomic Time | Atomic clocks | Reference for other scales |
| TT | Terrestrial Time | TAI + 32.184s | Geocentric ephemerides |
| UT1 | Universal Time 1 | Earth rotation | Sidereal time, telescope pointing |
| GPS | GPS Time | Atomic (no leap seconds) | Satellite navigation |
| TCG | Geocentric Coordinate Time | Relativistic (Earth center) | Precise geocentric dynamics |
| TCB | Barycentric Coordinate Time | Relativistic (solar system) | Solar system dynamics |
| TDB | Barycentric Dynamical Time | TCB rescaled | Solar system ephemerides |
§Fixed vs Variable Offsets
Some conversions use constant offsets:
- TAI <-> TT: Fixed 32.184 seconds
- TAI <-> GPS: Fixed 19.0 seconds
- TT <-> TCG: Secular rate 6.969290134e-10 (IAU 2000)
- TCG <-> TCB: Secular rate 1.550519768e-8 (IAU 2006)
Others require external data that changes over time:
- UTC <-> TAI: Leap second table (currently 37 seconds as of 2017)
- UT1 <-> TAI: IERS Earth Orientation Parameters (changes daily)
- UT1 <-> TT: Delta-T from historical tables or predictions
- TT <-> TDB: Location-dependent, ~1.66ms annual oscillation
§Trait Pattern
Each target scale has a conversion trait:
ToTAI: Convert to International Atomic TimeToTT: Convert to Terrestrial TimeToGPS: Convert to GPS TimeToUTC: Convert to Coordinated Universal TimeToUT1: Convert to Universal Time 1ToTCG: Convert to Geocentric Coordinate Time
Additional traits handle conversions requiring parameters:
ToUT1WithOffset,ToTAIWithOffset: UT1 <-> TAI with IERS offsetToTTWithDeltaT,ToUT1WithDeltaT: UT1 <-> TT with historical Delta-TToTDB,ToTTFromTDB: TT <-> TDB with observer locationToTCB,ToTCGFromTCB: TCG <-> TCB relativistic conversions
§Usage
Simple fixed-offset conversions work directly:
use celestial_time::scales::{TAI, TT, GPS};
use celestial_time::scales::conversions::{ToTAI, ToTT};
use celestial_time::julian::JulianDate;
let tai = TAI::from_julian_date(JulianDate::new(2451545.0, 0.0));
let tt = tai.to_tt().unwrap(); // TAI + 32.184sConversions requiring external data take parameters:
use celestial_time::scales::{TAI, UT1};
use celestial_time::scales::conversions::{ToUT1WithOffset, ToTAIWithOffset};
use celestial_time::julian::JulianDate;
// UT1-TAI offset from IERS Bulletin A
let ut1_tai_offset = -37.0; // seconds
let tai = TAI::from_julian_date(JulianDate::new(2451545.0, 0.0));
let ut1 = tai.to_ut1_with_offset(ut1_tai_offset).unwrap();
let back = ut1.to_tai_with_offset(ut1_tai_offset).unwrap();§Precision Notes
All conversions preserve precision by applying offsets to the smaller-magnitude component of the two-part Julian Date. Round-trip conversions maintain sub-nanosecond accuracy for fixed-offset scales.
Re-exports§
pub use tcb_tdb::*;pub use tcg_tcb::*;pub use tt_tdb::*;pub use ut1_tai::*;pub use utc_tai::*;pub use utc_ut1::*;
Modules§
- gps_tai
- GPS and TAI time scale conversions.
- tai_tt
- Conversions between TAI, TT, and TCG time scales.
- tcb_tdb
- Conversions between Barycentric Coordinate Time (TCB) and Barycentric Dynamical Time (TDB).
- tcg_tcb
- Conversions between Geocentric Coordinate Time (TCG) and Barycentric Coordinate Time (TCB).
- tt_tcg
- Conversions between Terrestrial Time (TT) and Geocentric Coordinate Time (TCG).
- tt_tdb
- TT (Terrestrial Time) and TDB (Barycentric Dynamical Time) conversions.
- ut1_tai
- Conversions between UT1, TAI, and TT time scales.
- utc_tai
- Conversions between Coordinated Universal Time (UTC) and International Atomic Time (TAI).
- utc_ut1
- Conversions between Coordinated Universal Time (UTC) and Universal Time (UT1).
Traits§
- ToGPS
- Convert a time scale to GPS Time.
- ToTAI
- Convert a time scale to International Atomic Time (TAI).
- ToTCG
- Convert a time scale to Geocentric Coordinate Time (TCG).
- ToTT
- Convert a time scale to Terrestrial Time (TT).
- ToUT1
- Convert a time scale to Universal Time 1 (UT1).
- ToUTC
- Convert a time scale to Coordinated Universal Time (UTC).