#[non_exhaustive]#[repr(u8)]pub enum Scale {
Show 16 variants
TAI = 0,
TT = 1,
ET = 2,
TDB = 3,
UTC = 4,
UtcSpice = 5,
UtcHist = 6,
GPS = 7,
GST = 8,
BDT = 9,
QZSS = 10,
TCG = 11,
TCB = 12,
LTC = 13,
TCL = 14,
Custom = 15,
}Expand description
Time scales supported by the library.
This #[non_exhaustive] enum defines all time scales that [Dt] can represent.
Each [Dt] instance stores its internal time value on the scale indicated by
its scale field.
§UTC and Leap Seconds
The library supports three UTC variants:
-
UTC— Modern UTC using the library’s built-in IERS leap second table. Basic functions for run-time loading of leap seconds tables also available. -
UtcSpice— SPICE-compatible model. Uses a fixed +9 s offset before 1972-01-01 and modern leap seconds afterward. -
UtcHist— Full historical SOFA model with piecewise linear frequency offsets (“rubber seconds”) from 1961–1972. This variant does not support round-tripping.
§Scale Categories
| Category | Scales | Purpose |
|---|---|---|
| Atomic / Proper | TAI, TT, TDB (alias ET) | Continuous atomic time. TAI is the primary internal scale. |
| Relativistic Coordinate | TCG, TCB, TCL | Time scales defined in specific relativistic reference frames (GCRS, BCRS, LCRS). |
| Civil / Coordinated | UTC, UtcSpice, UtcHist | Real-world civil time, with support for leap seconds and historical behavior. |
| GNSS / Navigation | GPS, GST, BDT, QZSS | Time scales used by satellite navigation constellations. |
| Lunar | LTC, TCL | Lunar time scales based on the LTE440 model (Lu et al. 2025). |
| Special | Custom | User-defined or experimental scales. |
The reference epoch used for conversions between scales is 2000-01-01 12:00:00 TAI.
§Lunar Time Scales
Both LTC and TCL implement the LTE440 model (Lu et al. 2025):
-
LTC(Coordinated Lunar Time): Operational lunar time for cislunar operations. Applies a secular rate of +56.02 µs per Earth day relative to TT, plus the 13 dominant periodic terms from the model. -
TCL(Lunar Coordinate Time): IAU-defined relativistic coordinate time in the Lunar Celestial Reference System (LCRS). Includes the secular rate versus TDB, the same periodic terms, and a constant bias calibrated to match the published LTE440 reference value at J2000.0 TDB.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TAI = 0
International Atomic Time (TAI).
TT = 1
Terrestrial Time (TT).
A smooth, continuous atomic time scale used in astronomy and dynamics.
ET = 2
Ephemeris Time (alias for TDB).
TDB = 3
Barycentric Dynamical Time (TDB).
Used for planetary and spacecraft calculations.
UTC = 4
Coordinated Universal Time (UTC) using modern leap second rules.
UtcSpice = 5
Coordinated Universal Time using the SPICE historical model (fixed +9 s offset before 1972).
UtcHist = 6
Coordinated Universal Time using the full historical SOFA model (with “rubber seconds” between 1960–1972).
Round-tripping is not supported.
GPS = 7
GPS Time.
The time scale used by the U.S. GPS satellite navigation system.
GST = 8
Galileo Time.
The time scale used by Europe’s Galileo satellite navigation system.
BDT = 9
BeiDou Time.
The time scale used by China’s BeiDou satellite navigation system.
QZSS = 10
QZSS Time.
The time scale used by Japan’s QZSS satellite system (similar to GPS).
TCG = 11
Geocentric Coordinate Time (TCG).
A relativistic time scale centered on Earth, used for high-precision work near Earth (e.g. satellite orbits).
TCB = 12
Barycentric Coordinate Time (TCB).
A relativistic time scale for the entire solar system.
LTC = 13
Coordinated Lunar Time (LTC).
Operational lunar time scale intended for cislunar operations. Based on the LTE440 model.
TCL = 14
Lunar Coordinate Time (TCL).
Theoretical relativistic coordinate time at the Moon’s center of mass. Based on the LTE440 model.
Custom = 15
Custom / user-defined scale.
Implementations§
Source§impl Scale
impl Scale
Sourcepub const fn to_utc(&self) -> Scale
pub const fn to_utc(&self) -> Scale
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”).
Trait Implementations§
impl Copy for Scale
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>,
impl Eq for Scale
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
impl StructuralPartialEq for Scale
Source§impl Tsify for Scale
impl Tsify for Scale
const DECL: &'static str = "/**\n * Time scales supported by the library.\n *\n * This `#[non_exhaustive]` enum defines all time scales that [`Dt`] can represent.\n * Each [`Dt`] instance stores its internal time value on the scale indicated by\n * its `scale` field.\n *\n * ## UTC and Leap Seconds\n *\n * The library supports three UTC variants:\n *\n * - **`UTC`** \u{2014} Modern UTC using the library\u{2019}s built-in IERS leap second table.\n * Basic functions for run-time loading of leap seconds tables also available.\n *\n * - **`UtcSpice`** \u{2014} SPICE-compatible model. Uses a fixed +9 s offset before\n * 1972-01-01 and modern leap seconds afterward.\n *\n * - **`UtcHist`** \u{2014} Full historical SOFA model with piecewise linear frequency\n * offsets (\\\"rubber seconds\\\") from 1961\u{2013}1972. This variant does **not support\n * round-tripping**.\n *\n * ## Scale Categories\n *\n * | Category | Scales | Purpose |\n * |-----------------------------|---------------------------------|---------|\n * | **Atomic / Proper** | `TAI`, `TT`, `TDB` (alias `ET`) | Continuous atomic time. `TAI` is the primary internal scale. |\n * | **Relativistic Coordinate** | `TCG`, `TCB`, `TCL` | Time scales defined in specific relativistic reference frames (GCRS, BCRS, LCRS). |\n * | **Civil / Coordinated** | `UTC`, `UtcSpice`, `UtcHist` | Real-world civil time, with support for leap seconds and historical behavior. |\n * | **GNSS / Navigation** | `GPS`, `GST`, `BDT`, `QZSS` | Time scales used by satellite navigation constellations. |\n * | **Lunar** | `LTC`, `TCL` | Lunar time scales based on the LTE440 model (Lu et al. 2025). |\n * | **Special** | `Custom` | User-defined or experimental scales. |\n *\n * The reference epoch used for conversions between scales is **2000-01-01 12:00:00 TAI**.\n *\n * ## Lunar Time Scales\n *\n * Both `LTC` and `TCL` implement the **LTE440** model (Lu et al. 2025):\n *\n * - **`LTC`** (Coordinated Lunar Time): Operational lunar time for cislunar operations.\n * Applies a secular rate of **+56.02 \u{b5}s per Earth day** relative to TT, plus the\n * 13 dominant periodic terms from the model.\n *\n * - **`TCL`** (Lunar Coordinate Time): IAU-defined relativistic coordinate time\n * in the Lunar Celestial Reference System (LCRS). Includes the secular rate\n * versus TDB, the same periodic terms, and a constant bias calibrated to match\n * the published LTE440 reference value at J2000.0 TDB.\n */\nexport type Scale = \"TAI\" | \"TT\" | \"ET\" | \"TDB\" | \"UTC\" | \"UtcSpice\" | \"UtcHist\" | \"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>
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.