Skip to main content

Module scales

Module scales 

Source
Expand description

Astronomical time scales.

Provides implementations of the eight primary time scales used in astronomical calculations: UTC, TAI, TT, UT1, GPS, TDB, TCB, and TCG.

§Time Scale Overview

ScaleDescriptionTAI Relationship
TAIInternational Atomic TimeReference
UTCCoordinated Universal TimeTAI - leap seconds
TTTerrestrial TimeTAI + 32.184s
UT1Earth rotation timeRequires EOP data
GPSGPS satellite timeTAI - 19s
TCGGeocentric Coordinate TimeLinear scale from TT
TDBBarycentric Dynamical TimeTT + periodic terms
TCBBarycentric Coordinate TimeLinear scale from TDB

§Usage

Each time scale is a newtype wrapping a Julian Date. Create instances via from_julian_date or *_from_calendar helper functions:

use celestial_time::{JulianDate, TAI, TT, UTC};
use celestial_time::scales::{tai_from_calendar, tt_from_calendar};

// From Julian Date
let tai = TAI::from_julian_date(JulianDate::new(2451545.0, 0.0));

// From calendar components
let tt = tt_from_calendar(2000, 1, 1, 12, 0, 0.0);

§Conversions

Convert between scales using traits from the conversions submodule:

use celestial_time::{JulianDate, GPS, TAI, TT};
use celestial_time::scales::conversions::{ToTAI, ToTT, ToGPS};

let tai = TAI::from_julian_date(JulianDate::new(2451545.0, 0.0));
let tt = tai.to_tt().unwrap();
let gps = tai.to_gps().unwrap();

Some conversions chain through intermediate scales internally. For example, GPS to TT converts GPS -> TAI -> TT.

§Precision

All time scales use split Julian Date storage (jd1, jd2) to preserve nanosecond precision. When adding offsets, the offset is applied to the smaller-magnitude component.

Re-exports§

pub use gps::gps_from_calendar;
pub use gps::GPS;
pub use tai::tai_from_calendar;
pub use tai::TAI;
pub use tcb::tcb_from_calendar;
pub use tcb::TCB;
pub use tcg::tcg_from_calendar;
pub use tcg::TCG;
pub use tdb::tdb_from_calendar;
pub use tdb::TDB;
pub use tt::tt_from_calendar;
pub use tt::TT;
pub use ut1::ut1_from_calendar;
pub use ut1::UT1;
pub use utc::utc_from_calendar;
pub use utc::UTC;
pub use conversions::ToTAI;
pub use conversions::ToTCB;
pub use conversions::ToTCG;
pub use conversions::ToTCGFromTCB;
pub use conversions::ToTDB;
pub use conversions::ToTT;
pub use conversions::ToTTFromTDB;

Modules§

common
conversions
Time scale conversions between astronomical time systems.
gps
GPS Time scale.
tai
International Atomic Time (TAI) scale.
tcb
Barycentric Coordinate Time (TCB) representation.
tcg
Geocentric Coordinate Time (TCG) time scale.
tdb
Barycentric Dynamical Time (TDB) scale.
tt
Terrestrial Time (TT) time scale.
ut1
Universal Time UT1 time scale.
utc
Coordinated Universal Time (UTC) representation.