Skip to main content

Scale

Enum Scale 

Source
#[non_exhaustive]
#[repr(u8)]
pub enum Scale {
Show 16 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, Custom = 15,
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

§

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 official lunar coordinate time scale (analogous to TCG). Defined from the NIST/Ashby & Patla (2024) relativistic framework adopted for Artemis and cislunar operations.

Lunar clocks on the selenoid run faster than terrestrial clocks by a constant secular rate of +56.02 µs per Earth day (L_M = 6.48378 × 10^{-10}). A small additional periodic variation exists due to lunar orbital eccentricity (±0.108 µs/day in instantaneous rate, ~±0.75 µs accumulated over one orbit). The periodic term is not part of the defining LTC conversion; it is handled via ClockModel / ClockDrift when utmost precision is required.

§

Custom = 15

Custom / user-defined type – for experimental or mission-specific timescales. Most powerful when paired with ClockModel (self-describing polynomial).

Implementations§

Source§

impl Scale

Source

pub const WIRE_SIZE: usize = 1

Size of the canonical wire representation in bytes.

Source

pub const fn to_ut(&self) -> Self

Source

pub const fn is_ut(&self) -> bool

Returns true if this scale accounts for leap seconds (or historical UTC civil time rules).

Source

pub const fn is_gnss(&self) -> bool

Returns true if this scale is based off a GNSS constellation.

Source

pub fn from_abbrev(s: &str) -> Option<Self>

Parse scale from abbreviation. Returns None for any non-ASCII input.

Source

pub const fn abbrev(&self) -> &'static str

Short abbreviation used for formatting / display (e.g. “TAI”, “UTC”, “UTCSpice”).

Source

pub const fn eq(self, other: Self) -> bool

Const-friendly equality comparison (does not rely on == for the enum itself).

Source

pub const fn from_u8(v: u8) -> Option<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.

Source

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 Clone for Scale

Source§

fn clone(&self) -> Scale

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Scale

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Scale

Source§

fn default() -> Scale

Returns the “default value” for a type. Read more
Source§

impl Display for Scale

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Scale

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Scale

Source§

fn cmp(&self, other: &Scale) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Scale

Source§

fn eq(&self, other: &Scale) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Scale

Source§

fn partial_cmp(&self, other: &Scale) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Scale

Source§

impl Eq for Scale

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.