TimeTransforms

Struct TimeTransforms 

Source
pub struct TimeTransforms;
Expand description

Time system transformations.

Provides conversions between different astronomical time scales.

Implementations§

Source§

impl TimeTransforms

Source

pub fn utc_to_tai(utc: &UTC) -> TAI

Convert UTC to TAI.

TAI = UTC + leap_seconds

Source

pub fn tai_to_utc(tai: &TAI) -> UTC

Convert TAI to UTC.

UTC = TAI - leap_seconds

Note: This requires knowing the leap seconds at the TAI time, which technically requires iterating since leap seconds are defined in UTC. We use an approximation that works for normal use cases.

Source

pub fn tai_to_tt(tai: &TAI) -> TT

Convert TAI to TT.

TT = TAI + 32.184 seconds

Source

pub fn tt_to_tai(tt: &TT) -> TAI

Convert TT to TAI.

TAI = TT - 32.184 seconds

Source

pub fn tai_to_gps(tai: &TAI) -> GPS

Convert TAI to GPS time.

GPS = TAI - 19 seconds (offset since GPS epoch)

Source

pub fn gps_to_tai(gps: &GPS) -> TAI

Convert GPS time to TAI.

Source

pub fn utc_to_tt(utc: &UTC) -> TT

Convert UTC directly to TT.

Source

pub fn tt_to_utc(tt: &TT) -> UTC

Convert TT directly to UTC.

Source

pub fn utc_to_gps(utc: &UTC) -> GPS

Convert UTC directly to GPS time.

Source

pub fn gps_to_utc(gps: &GPS) -> UTC

Convert GPS time directly to UTC.

Source

pub fn utc_to_jd(utc: &UTC) -> JulianDate

Convert UTC to Julian Date.

Source

pub fn jd_to_utc(jd: &JulianDate) -> UTC

Convert Julian Date to UTC.

Source

pub fn utc_to_gmst(utc: &UTC) -> GMST

Calculate GMST from UTC time using the IAU 1982 expression.

Source

pub fn jd_to_gmst(jd: &JulianDate) -> GMST

Calculate GMST from Julian Date.

Source

pub fn datetime_to_utc(dt: &DateTime<Utc>) -> UTC

Convert a chrono DateTime<Utc> to UTC.

Source

pub fn utc_to_datetime(utc: &UTC) -> DateTime<Utc>

Convert UTC to a chrono DateTime<Utc>.

Source

pub fn datetime_to_tt(dt: &DateTime<Utc>) -> TT

Convert a chrono DateTime<Utc> directly to TT.

Source

pub fn datetime_to_jd(dt: &DateTime<Utc>) -> JulianDate

Convert a chrono DateTime<Utc> directly to Julian Date.

Source

pub fn julian_centuries_j2000(dt: &DateTime<Utc>) -> f64

Get Julian centuries since J2000.0 for a DateTime.

Auto Trait Implementations§

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> 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.