#[non_exhaustive]#[repr(u8)]pub enum Scale {
Show 17 variants
TAI = 0,
TT = 1,
ET = 2,
TDB = 3,
UTC = 4,
UT1 = 5,
UTCSpice = 6,
UTCSofa = 7,
GPS = 8,
GST = 9,
BDT = 10,
QZSS = 11,
TCG = 12,
TCB = 13,
LTC = 14,
TCL = 15,
Custom = 16,
}Expand description
Time scales supported for conversions.
This #[non_exhaustive] enum defines the complete set of time scales used by
the library for representing instants (Epoch) and performing conversions
between them.
It covers atomic, dynamical, coordinate, civil/coordinated, GNSS, and emerging
lunar scales, plus a Custom variant for mission-specific or experimental use.
§Overview
Time scales fall into several broad categories:
- Atomic / proper time scales: TAI (basis), TT, TDB/ET — continuous and suitable for internal representation and dynamical modeling.
- Coordinate time scales (relativistic): TCG, TCB, TCL — defined in specific reference frames (GCRS, BCRS, LCRS). Ideal for ephemeris integration and high-accuracy modeling; not directly realized by clocks.
- Coordinated / civil scales: UTC (atomic time with leap seconds inserted to keep it close to UT1), UT1 (observed Earth rotation angle — does not use leap seconds), and the lunar operational scale LTC (uses defined secular rate offsets for traceability and cislunar operations).
- GNSS / navigation scales: GPS, GST, BDT, QZSS — tied to specific satellite constellations.
- Custom: User-defined scales, most powerful when combined with a
ClockModel(self-describing polynomial drift, bias, etc.).
The default variant is [TAI], which serves as the internal canonical
representation in many high-precision time libraries because it is
continuous and forms the foundation for most conversions.
The library’s epoch when performing conversions between all scales is 2000-01-01 noon.
§Lunar Time Scales (LTC and TCL)
The library provides high-accuracy implementations of both lunar time scales based on the LTE440 model (Lu et al. 2025, A&A 704, A76):
-
[
LTC] (Coordinated Lunar Time): Applies the secular rate offset (L_M ≈ +56.02 µs/day) plus the 13 dominant periodic terms from LTE440. Conversions use fixed-point iteration for numerical stability. Achieves sub-nanosecond accuracy (< 0.15 ns before 2050) when the periodic terms are included. -
[
TCL] (Lunar Coordinate Time): IAU-defined relativistic coordinate time in the LCRS. The implementation includes the secular rate vs TDB, the same LTE440 periodic terms, and a constant bias calibrated so that the model exactly reproduces the official LTE440 reference value at J2000.0 TDB. Inverse conversion also uses fixed-point iteration.
Periodic corrections are applied directly in the Scale conversions (not
delegated to ClockModel). This gives users accurate results out of the box
for both operational (LTC) and coordinate (TCL) lunar timekeeping.
See the documentation on the individual variants for rates, historical models, and conversion notes.
§Features
serde— full serialization/deserialization support.js— TypeScript definitions viatsify.
§Non-exhaustive
The enum is marked #[non_exhaustive] so new scales can be added in
future minor versions without breaking changes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TAI = 0
TAI is the representation of an Epoch internally.
TT = 1
Terrestrial Time (TT) (previously called Terrestrial Dynamical Time (TDT)).
ET = 2
Ephemeris Time as defined by NASA/NAIF SPICE (identical to TDB).
TDB = 3
Barycentric Dynamical Time (TDB) — SPICE ephemeris time (ET is an alias for this).
UTC = 4
Universal Coordinated Time using modern IERS leap second rules.
UT1 = 5
UT1 — Universal Time based on the Earth’s rotation (observed, not uniform).
- Conversions to and from this scale must be performed using
[
Dt::to_offset_by_bop] and [Dt::from_offset_by_bop] with the"bop"feature enabled. - See [
deep_time::BopData] for more information.
UTCSpice = 6
Universal Coordinated Time using the SPICE historical model (fixed +9 s offset against TAI for all dates before 1972-01-01).
UTCSofa = 7
Universal Coordinated Time using the full SOFA historical model (varying fractional “rubber second” offsets from 1960–1971).
GPS = 8
GPS Time scale whose reference epoch is UTC midnight between 05 January and 06 January 1980.
GST = 9
Galileo Time scale.
BDT = 10
BeiDou Time scale.
QZSS = 11
QZSS Time scale has the same properties as GPS but with dedicated clocks.
TCG = 12
Geocentric Coordinate Time (TCG) – relativistic coordinate time in the Geocentric Celestial Reference System (GCRS).
TCB = 13
Barycentric Coordinate Time (TCB) – relativistic coordinate time in the Barycentric Celestial Reference System (BCRS).
LTC = 14
Coordinated Lunar Time (LTC) – NASA’s operational lunar time scale for Artemis and cislunar operations (based on the NIST/Ashby & Patla relativistic framework).
Implements the full LTE440 model (Lu et al. 2025):
- Secular rate: +56.02 µs per Earth day (
L_M = 6.48378 × 10^{-10}) relative to terrestrial time. - Plus the 13 dominant periodic terms (> 1 µs amplitude) from the LTE440 ephemeris.
TCL = 15
Lunar Coordinate Time (TCL) – IAU-defined (2024 Resolution II) relativistic coordinate time in the Lunar Celestial Reference System (LCRS).
Directly analogous to TCG. This is the theoretical coordinate time at the Moon’s center of mass.
The implementation follows the LTE440 model (Lu et al. 2025):
- Secular rate vs TDB (
L_D^M). - The same 13-term LTE440 periodic series used for LTC.
- A constant bias (
TCL_TDB_BIAS_SPAN) calibrated so the model exactly reproduces the published LTE440 reference value at J2000.0 TDB.
Custom = 16
Custom / user-defined type – for experimental or mission-specific timescales.
Most powerful when paired with ClockModel (self-describing polynomial).
Implementations§
Source§impl Scale
impl Scale
Sourcepub const fn to_ut(&self) -> Self
pub const fn to_ut(&self) -> Self
Converts this Scale to UTC.
- If the scale is already one of the UTC variants including historical UTC then no change occurs.
Sourcepub const fn uses_leap_seconds(&self) -> bool
pub const fn uses_leap_seconds(&self) -> bool
Returns true if this scale accounts for leap seconds
(or historical UTC civil time rules).
Sourcepub const fn is_gnss(&self) -> bool
pub const fn is_gnss(&self) -> bool
Returns true if this scale is based off a GNSS constellation.
Sourcepub fn from_abbrev(s: &str) -> Option<Self>
pub fn from_abbrev(s: &str) -> Option<Self>
Parse scale from abbreviation.
Returns None for any non-ASCII input.
Sourcepub const fn abbrev(&self) -> &'static str
pub const fn abbrev(&self) -> &'static str
Short abbreviation used for formatting / display (e.g. “TAI”, “UTC”, “UTCSpice”).
Sourcepub const fn from_u8(v: u8) -> Self
pub const fn from_u8(v: u8) -> Self
Attempts to reconstruct a Scale from its wire byte representation.
Returns None for any value that does not correspond to a known variant.
This provides safe deserialization from untrusted sources.
Sourcepub const fn to_wire_byte(self) -> u8
pub const fn to_wire_byte(self) -> u8
Returns the wire representation of this Scale as a single byte.
The returned byte is the repr(u8) discriminant of the enum.
This is the canonical on-wire form used by [Dt] and [ClockModel].
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Scale
impl<'de> Deserialize<'de> for Scale
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for Scale
impl Ord for Scale
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Scale
impl PartialOrd for Scale
Source§impl Tsify for Scale
impl Tsify for Scale
const DECL: &'static str = "/**\n * Time scales supported for conversions.\n *\n * This `#[non_exhaustive]` enum defines the complete set of time scales used by\n * the library for representing instants (`Epoch`) and performing conversions\n * between them.\n *\n * It covers atomic, dynamical, coordinate, civil/coordinated, GNSS, and emerging\n * lunar scales, plus a `Custom` variant for mission-specific or experimental use.\n *\n * ## Overview\n *\n * Time scales fall into several broad categories:\n *\n * - **Atomic / proper time scales**: TAI (basis), TT, TDB/ET \u{2014} continuous and\n * suitable for internal representation and dynamical modeling.\n * - **Coordinate time scales** (relativistic): TCG, TCB, **TCL** \u{2014} defined in\n * specific reference frames (GCRS, BCRS, LCRS). Ideal for ephemeris\n * integration and high-accuracy modeling; not directly realized by clocks.\n * - **Coordinated / civil scales**: UTC (atomic time with leap seconds inserted\n * to keep it close to UT1), **UT1** (observed Earth rotation angle \u{2014} does **not**\n * use leap seconds), and the lunar operational scale **LTC** (uses defined\n * secular rate offsets for traceability and cislunar operations).\n * - **GNSS / navigation scales**: GPS, GST, BDT, QZSS \u{2014} tied to specific\n * satellite constellations.\n * - **Custom**: User-defined scales, most powerful when combined with a\n * `ClockModel` (self-describing polynomial drift, bias, etc.).\n *\n * The default variant is [`TAI`], which serves as the internal canonical\n * representation in many high-precision time libraries because it is\n * continuous and forms the foundation for most conversions.\n *\n * The library\\\'s epoch when performing conversions between all scales is\n * 2000-01-01 noon.\n *\n * ## Lunar Time Scales (LTC and TCL)\n *\n * The library provides high-accuracy implementations of both lunar time scales\n * based on the **LTE440** model (Lu et al. 2025, A&A 704, A76):\n *\n * - [`LTC`] (Coordinated Lunar Time): Applies the secular rate offset\n * (`L_M \u{2248} +56.02 \u{b5}s/day`) **plus** the 13 dominant periodic terms from LTE440.\n * Conversions use fixed-point iteration for numerical stability.\n * Achieves sub-nanosecond accuracy (< 0.15 ns before 2050) when the periodic\n * terms are included.\n *\n * - [`TCL`] (Lunar Coordinate Time): IAU-defined relativistic coordinate time\n * in the LCRS. The implementation includes the secular rate vs TDB, the same\n * LTE440 periodic terms, and a constant bias calibrated so that the model\n * exactly reproduces the official LTE440 reference value at J2000.0 TDB.\n * Inverse conversion also uses fixed-point iteration.\n *\n * Periodic corrections are applied directly in the `Scale` conversions (not\n * delegated to `ClockModel`). This gives users accurate results out of the box\n * for both operational (`LTC`) and coordinate (`TCL`) lunar timekeeping.\n *\n * See the documentation on the individual variants for rates, historical\n * models, and conversion notes.\n *\n * ## Features\n *\n * - `serde` \u{2014} full serialization/deserialization support.\n * - `js` \u{2014} TypeScript definitions via `tsify`.\n *\n * ## Non-exhaustive\n *\n * The enum is marked `#[non_exhaustive]` so new scales can be added in\n * future minor versions without breaking changes.\n */\nexport type Scale = \"TAI\" | \"TT\" | \"ET\" | \"TDB\" | \"UTC\" | \"UT1\" | \"UTCSpice\" | \"UTCSofa\" | \"GPS\" | \"GST\" | \"BDT\" | \"QZSS\" | \"TCG\" | \"TCB\" | \"LTC\" | \"TCL\" | \"Custom\";"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
impl Copy for Scale
impl Eq for Scale
impl StructuralPartialEq for Scale
Auto Trait Implementations§
impl Freeze for Scale
impl RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnsafeUnpin for Scale
impl UnwindSafe for Scale
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.