Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Time scales

The timestamp in your image header is UTC. Precession and nutation want Terrestrial Time. Sidereal time wants UT1 for the Earth’s rotation. A planetary theory wants Barycentric Dynamical Time. All four name the same instant, and they disagree by more than a minute:

use celestial_time::julian::JulianDate;
use celestial_time::scales::conversions::tcb_tdb::TdbToTcb;
use celestial_time::scales::conversions::tt_tdb::ToTDB;
use celestial_time::scales::conversions::utc_ut1::ToUT1WithDUT1;
use celestial_time::scales::conversions::{ToGPS, ToTAI, ToTCG, ToTT};
use celestial_time::scales::utc::UTC;

let utc: UTC = "2026-03-20T14:46:00Z".parse()?;

let tai = utc.to_tai()?;
let tt = tai.to_tt()?;
let gps = tai.to_gps()?;
let ut1 = utc.to_ut1_with_dut1(0.0624)?; // UT1 - UTC, from IERS data
let tcg = tt.to_tcg()?;
let tdb = tt.to_tdb_greenwich()?;
let tcb = tdb.tdb_to_tcb()?;

let utc_jd = utc.to_julian_date();
let ahead = |jd: JulianDate| (jd - utc_jd) * 86400.0;
println!("TAI - UTC = {:.6} s", ahead(tai.to_julian_date()));
println!("GPS - UTC = {:.6} s", ahead(gps.to_julian_date()));
println!("TT  - UTC = {:.6} s", ahead(tt.to_julian_date()));
println!("UT1 - UTC = {:.6} s", ahead(ut1.to_julian_date()));
println!("TDB - UTC = {:.6} s", ahead(tdb.to_julian_date()));
println!("TCG - UTC = {:.6} s", ahead(tcg.to_julian_date()));
println!("TCB - UTC = {:.6} s", ahead(tcb.to_julian_date()));
// TAI - UTC = 37.000000 s
// GPS - UTC = 18.000000 s
// TT  - UTC = 69.184000 s
// UT1 - UTC = 0.062400 s
// TDB - UTC = 69.185580 s
// TCG - UTC = 70.266396 s
// TCB - UTC = 93.266663 s

Pass UTC where TT belongs and nutation is computed for a moment 69 seconds away. Pass TT where UT1 belongs and the sky is rotated by about 17 arcminutes. celestial-time turns these mistakes into compile errors. Each scale is its own type, and functions such as GMST::from_ut1_and_tt(&UT1, &TT) ask for the scale they need.

Why there are so many

Each scale answers a different question, and no single clock answers all of them.

How much time has passed? Atomic clocks answer this. TAI (International Atomic Time) is the average of hundreds of them, kept by the BIPM. It never jumps, so it’s the scale to subtract when you want an interval. GPS time is TAI minus a fixed 19 seconds, set when GPS started in 1980.

What time is it on the wall? Civil time follows the Sun, and the Sun follows the Earth’s rotation, which is irregular and slowly getting longer. UTC ticks atomic seconds like TAI, but the IERS adds a leap second now and then to keep it within 0.9 s of the Earth’s rotation. TAI - UTC was 10 s in 1972 and has been 37 s since 2017. UTC and leap seconds covers how that works.

Which way is the Earth facing? UT1 is the Earth’s rotation angle expressed as a time. It can’t be predicted far ahead, so the IERS measures it and publishes UT1 - UTC, called DUT1. Sidereal time uses it.

What time argument do the theories use? Equations of motion need a uniform time. TT (Terrestrial Time) is the one for geocentric work: TAI plus exactly 32.184 s, an offset chosen to continue the older Ephemeris Time. The precession and nutation models in celestial-core take TT.

What about relativity? A clock’s rate depends on its speed and the gravity around it, so “uniform time” depends on where you put the clock. Three more scales handle that:

  • TCG (Geocentric Coordinate Time) is the time of a clock at the Earth’s center, outside the Earth’s gravity. It runs faster than TT by the defining rate L_G = 6.969290134e-10, about 22 ms a year.
  • TCB (Barycentric Coordinate Time) is the same idea at the solar system’s center of mass. It runs faster than TDB by L_B = 1.550519768e-8, about 0.49 s a year.
  • TDB (Barycentric Dynamical Time) is TCB rescaled so it keeps pace with TT on average. TDB - TT oscillates by about 1.7 ms over a year and never drifts away. The theories in celestial-ephemeris take TDB.

TCG and TCB matter for relativistic modeling such as pulsar timing and VLBI. For most work you need UTC to read your timestamps, TT for the IAU models, UT1 for the Earth’s rotation and TDB for the ephemerides.

How the scales connect

Every conversion goes through a trait method. Some pairs are fixed offsets or defined rates and need nothing else. The rest need data you supply:

UTC --(leap second table)-- TAI --(32.184 s)-- TT --(series)-- TDB --(L_B)-- TCB
 |                           |                  |
 |                        (19 s)             (L_G)
 |                           |                  |
 |                          GPS                TCG
 |
 +--(DUT1)-- UT1 --(Delta T)-- TT

A conversion with no direct trait goes through TAI or TT. GPS to TT is gps.to_tai()?.to_tt()?. UTC to TDB is utc.to_tai()?.to_tt()?.to_tdb_greenwich()?.

The table lists every trait. They’re all in celestial_time::scales::conversions; a prefix such as utc_ut1:: is the submodule that defines the traits in that row.

From and toTraitsYou supply
UTC and TAIToTAI, ToUTCnothing
TAI and TTToTT, ToTAInothing
TAI or TT and TCGToTCG, ToTAI, ToTTnothing
TAI and GPSToGPS, ToTAInothing
UTC and UT1utc_ut1::ToUT1WithDUT1, ToUTCWithDUT1DUT1 in seconds
TAI and UT1ut1_tai::ToUT1WithOffset, ToTAIWithOffsetUT1 - TAI in seconds
TT and UT1ut1_tai::ToUT1WithDeltaT, ToTTWithDeltaTDelta T in seconds
TT and TDBtt_tdb::ToTDB, ToTTFromTDBobserver location, Greenwich, or TDB - TT
TDB and TCBtcb_tdb::TdbToTcb, TcbToTdbnothing

The crate ships no Earth orientation data. That’s why the UT1 conversions take an offset argument: DUT1 changes every day, and only you know which IERS bulletin you trust. Delta T (TT - UT1) is the same quantity from the other side, and the form you’ll find in tables of historical values.

TT to TDB depends on where you are

TDB - TT is mostly an annual term from the Earth’s elliptical orbit, but a clock on the Earth’s surface also moves with the Earth’s spin. The series this crate uses, by Fairhead and Bretagnon (1990), has 787 terms plus a few small terms that depend on the observer. That’s why ToTDB asks where you are:

use celestial_core::location::Location;
use celestial_time::scales::conversions::tt_tdb::ToTDB;
use celestial_time::scales::tt::tt_from_calendar;

let mauna_kea = Location::from_degrees(19.8207, -155.4681, 4205.0)?;

for month in [1, 4, 7, 10] {
    let tt = tt_from_calendar(2026, month, 1, 0, 0, 0.0)?;
    let at_greenwich = tt.to_tdb_greenwich()?.to_julian_date() - tt.to_julian_date();
    let at_site = tt.to_tdb_with_location(&mauna_kea)?.to_julian_date() - tt.to_julian_date();
    println!(
        "2026-{month:02}-01  TDB - TT = {:+.6} ms, site - Greenwich = {:+.1} ns",
        at_greenwich * 86400.0e3,
        (at_site - at_greenwich) * 86400.0e9
    );
}
// 2026-01-01  TDB - TT = -0.082117 ms, site - Greenwich = -817.1 ns
// 2026-04-01  TDB - TT = +1.629221 ms, site - Greenwich = -299.3 ns
// 2026-07-01  TDB - TT = +0.118783 ms, site - Greenwich = -905.4 ns
// 2026-10-01  TDB - TT = -1.629318 ms, site - Greenwich = -1136.5 ns

The site term is about a microsecond. For a planet position that’s nothing, and to_tdb_greenwich() is fine. It uses the Royal Observatory at 51.477928° N, 0°, 46 m. For pulsar timing or anything else at the microsecond level, pass your location.

The observer terms also need UT1 to know the local solar time. The location methods take UT1 = TT, which moves the result by about 10 ns. When that matters, call to_tdb_with_location_and_ut1_offset(&location, ut1_minus_tt) with UT1 - TT in seconds (that is, minus Delta T). When you already have TDB - TT from elsewhere, such as a JPL kernel, to_tdb_with_offset(seconds) applies it as given.

TDB has no to_tt(). ToTTFromTDB has the same four methods in the other direction, so a TDB value can’t come back to TT without someone choosing a location.

Edge cases

  • UTC::j2000() and the other scales’ j2000() return JD 2451545.0 on that scale. The J2000.0 epoch is defined in TT, so UTC::j2000() is 64.184 s after it and TAI::j2000() is 32.184 s after it.
  • Conversions reject a JulianDate with a NaN or infinite part, and reject NaN or infinite offsets such as DUT1, with a TimeError.
  • ToTTFromTDB evaluates TDB - TT at the TDB date rather than the TT date. The two are 1.7 ms apart at most, which moves the result by less than a picosecond.

Where next