Skip to main content

TimeScale

Trait TimeScale 

Source
pub trait TimeScale:
    Copy
    + Clone
    + Debug
    + PartialEq
    + PartialOrd
    + 'static {
    const LABEL: &'static str;

    // Required methods
    fn to_jd_tt(value: Days) -> Days;
    fn from_jd_tt(jd_tt: Days) -> Days;
}
Expand description

Marker trait for time scales.

A time scale defines:

  1. A human-readable label (e.g. "JD", "MJD", "TAI").
  2. A pair of conversion functions between the scale’s native quantity (in Days) and Julian Date in TT (JD(TT)) — the canonical internal representation used throughout the crate.

For pure epoch counters (JD, MJD, Unix Time, GPS) the conversions are trivial constant offsets that the compiler will inline and fold away.

For physical scales (TT, TDB, TAI) the conversions may include function-based corrections (e.g. the ≈1.7 ms TDB↔TT periodic term).

Required Associated Constants§

Source

const LABEL: &'static str

Display label used by Time formatting.

Required Methods§

Source

fn to_jd_tt(value: Days) -> Days

Convert a quantity in this scale’s native unit to an absolute JD(TT).

Source

fn from_jd_tt(jd_tt: Days) -> Days

Convert an absolute JD(TT) back to this scale’s native quantity.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl TimeScale for GPS

Source§

const LABEL: &'static str = "GPS"

Source§

impl TimeScale for JD

Source§

const LABEL: &'static str = "Julian Day:"

Source§

impl TimeScale for JDE

Source§

const LABEL: &'static str = "JDE"

Source§

impl TimeScale for MJD

Source§

const LABEL: &'static str = "MJD"

Source§

impl TimeScale for TAI

Source§

const LABEL: &'static str = "TAI"

Source§

impl TimeScale for TCB

Source§

const LABEL: &'static str = "TCB"

Source§

impl TimeScale for TCG

Source§

const LABEL: &'static str = "TCG"

Source§

impl TimeScale for TDB

Source§

const LABEL: &'static str = "TDB"

Source§

impl TimeScale for TT

Source§

const LABEL: &'static str = "TT"

Source§

impl TimeScale for UT

Source§

const LABEL: &'static str = "UT"

Source§

impl TimeScale for UnixTime

Source§

const LABEL: &'static str = "Unix"