[][src]Struct hifitime::Epoch

pub struct Epoch(_);

Defines an Epoch in TAI (temps atomique international) in seconds past 1900 January 01 at midnight (like the Network Time Protocol).

Refer to the appropriate functions for initializing this Epoch from different time systems or representations.

Implementations

impl Epoch[src]

pub fn from_tai_seconds(seconds: f64) -> Self[src]

Initialize an Epoch from the provided TAI seconds since 1900 January 01 at midnight

pub fn from_tai_days(days: f64) -> Self[src]

Initialize an Epoch from the provided TAI days since 1900 January 01 at midnight

pub fn from_mjd_tai(days: f64) -> Self[src]

pub fn from_jde_tai(days: f64) -> Self[src]

pub fn from_tt_seconds(seconds: f64) -> Self[src]

Initialize an Epoch from the provided TT seconds (approximated to 32.184s delta from TAI)

pub fn from_et_seconds(seconds: f64) -> Epoch[src]

pub fn from_tdb_seconds(seconds: f64) -> Epoch[src]

Initialize from Dynamic Barycentric Time (TDB) (same as SPICE ephemeris time) whose epoch is 2000 JAN 01 noon TAI

pub fn from_jde_et(days: f64) -> Self[src]

pub fn from_jde_tdb(days: f64) -> Self[src]

Initialize from Dynamic Barycentric Time (TDB) (same as SPICE ephemeris time) in JD days

pub fn maybe_from_gregorian_tai(
    year: i32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8,
    nanos: u32
) -> Result<Self, Errors>
[src]

Attempts to build an Epoch from the provided Gregorian date and time in TAI.

pub fn maybe_from_gregorian(
    year: i32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8,
    nanos: u32,
    ts: TimeSystem
) -> Result<Self, Errors>
[src]

Attempts to build an Epoch from the provided Gregorian date and time in the provided time system.

pub fn from_gregorian_tai(
    year: i32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8,
    nanos: u32
) -> Self
[src]

Builds an Epoch from the provided Gregorian date and time in TAI. If invalid date is provided, this function will panic. Use maybe_from_gregorian_tai if unsure.

pub fn from_gregorian_tai_at_midnight(year: i32, month: u8, day: u8) -> Self[src]

pub fn from_gregorian_tai_at_noon(year: i32, month: u8, day: u8) -> Self[src]

pub fn from_gregorian_tai_hms(
    year: i32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8
) -> Self
[src]

pub fn maybe_from_gregorian_utc(
    year: i32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8,
    nanos: u32
) -> Result<Self, Errors>
[src]

Attempts to build an Epoch from the provided Gregorian date and time in UTC.

pub fn from_gregorian_utc(
    year: i32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8,
    nanos: u32
) -> Self
[src]

Builds an Epoch from the provided Gregorian date and time in TAI. If invalid date is provided, this function will panic. Use maybe_from_gregorian_tai if unsure.

pub fn from_gregorian_utc_at_midnight(year: i32, month: u8, day: u8) -> Self[src]

pub fn from_gregorian_utc_at_noon(year: i32, month: u8, day: u8) -> Self[src]

pub fn from_gregorian_utc_hms(
    year: i32,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8
) -> Self
[src]

pub fn as_tai_seconds(self) -> f64[src]

pub fn as_tai_duration(self) -> Duration[src]

Returns this time in a Duration past J1900 counted in TAI

pub fn as_tai(self, unit: TimeUnit) -> f64[src]

Returns the epoch as a floating point value in the provided unit

pub fn as_tai_days(self) -> f64[src]

pub fn as_utc_seconds(self) -> f64[src]

Returns the number of UTC seconds since the TAI epoch

pub fn as_utc(self, unit: TimeUnit) -> f64[src]

Returns the number of UTC seconds since the TAI epoch

pub fn as_utc_days(self) -> f64[src]

Returns the number of UTC days since the TAI epoch

pub fn as_mjd_tai_days(self) -> f64[src]

as_mjd_days creates an Epoch from the provided Modified Julian Date in days as explained here. MJD epoch is Modified Julian Day at 17 November 1858 at midnight.

pub fn as_mjd_tai_seconds(self) -> f64[src]

Returns the Modified Julian Date in seconds TAI.

pub fn as_mjd_tai(self, unit: TimeUnit) -> f64[src]

pub fn as_mjd_utc_days(self) -> f64[src]

Returns the Modified Julian Date in days UTC.

pub fn as_mjd_utc(self, unit: TimeUnit) -> f64[src]

Returns the Modified Julian Date in the provided unit in UTC.

pub fn as_mjd_utc_seconds(self) -> f64[src]

Returns the Modified Julian Date in seconds UTC.

pub fn as_jde_tai_days(self) -> f64[src]

Returns the Julian days from epoch 01 Jan -4713, 12:00 (noon) as explained in "Fundamentals of astrodynamics and applications", Vallado et al. 4th edition, page 182, and on Wikipedia.

pub fn as_jde_tai(self, unit: TimeUnit) -> f64[src]

pub fn as_jde_tai_duration(self) -> Duration[src]

pub fn as_jde_tai_seconds(self) -> f64[src]

Returns the Julian seconds in TAI.

pub fn as_jde_utc_days(self) -> f64[src]

Returns the Julian days in UTC.

pub fn as_jde_utc_duration(self) -> Duration[src]

pub fn as_jde_utc_seconds(self) -> f64[src]

Returns the Julian seconds in UTC.

pub fn as_tt_seconds(self) -> f64[src]

Returns seconds past TAI epoch in Terrestrial Time (TT) (previously called Terrestrial Dynamical Time (TDT))

pub fn as_tt_duration(self) -> Duration[src]

pub fn as_tt_days(self) -> f64[src]

Returns days past TAI epoch in Terrestrial Time (TT) (previously called Terrestrial Dynamical Time (TDT))

pub fn as_tt_centuries_j2k(self) -> f64[src]

Returns the centuries pased J2000 TT

pub fn as_tt_since_j2k(self) -> Duration[src]

Returns the centuries pased J2000 TT

pub fn as_jde_tt_days(self) -> f64[src]

Returns days past Julian epoch in Terrestrial Time (TT) (previously called Terrestrial Dynamical Time (TDT))

pub fn as_jde_tt_duration(self) -> Duration[src]

pub fn as_mjd_tt_days(self) -> f64[src]

Returns days past Modified Julian epoch in Terrestrial Time (TT) (previously called Terrestrial Dynamical Time (TDT))

pub fn as_mjd_tt_duration(self) -> Duration[src]

pub fn as_gpst_seconds(self) -> f64[src]

Returns seconds past GPS Time Epoch, defined as UTC midnight of January 5th to 6th 1980 (cf. https://gssc.esa.int/navipedia/index.php/Time_References_in_GNSS#GPS_Time_.28GPST.29).

pub fn as_gpst_duration(self) -> Duration[src]

pub fn as_gpst_days(self) -> f64[src]

Returns days past GPS Time Epoch, defined as UTC midnight of January 5th to 6th 1980 (cf. https://gssc.esa.int/navipedia/index.php/Time_References_in_GNSS#GPS_Time_.28GPST.29).

pub fn as_et_seconds(self) -> f64[src]

Returns the Ephemeris Time seconds past epoch

pub fn as_et_duration(self) -> Duration[src]

pub fn as_tdb_seconds(self) -> f64[src]

Returns the Dynamic Barycentric Time (TDB) (higher fidelity SPICE ephemeris time) whose epoch is 2000 JAN 01 noon TAI (cf. https://gssc.esa.int/navipedia/index.php/Transformations_between_Time_Systems#TDT_-_TDB.2C_TCB)

pub fn as_tdb_duration(self) -> Duration[src]

pub fn as_jde_et_days(self) -> f64[src]

Returns the Ephemeris Time JDE past epoch

pub fn as_jde_et_duration(self) -> Duration[src]

pub fn as_jde_et(self, unit: TimeUnit) -> f64[src]

pub fn as_jde_tdb_duration(self) -> Duration[src]

pub fn as_jde_tdb_days(self) -> f64[src]

Returns the Dynamic Barycentric Time (TDB) (higher fidelity SPICE ephemeris time) whose epoch is 2000 JAN 01 noon TAI (cf. https://gssc.esa.int/navipedia/index.php/Transformations_between_Time_Systems#TDT_-_TDB.2C_TCB)

pub fn from_gregorian_str(s: &str) -> Result<Self, Errors>[src]

Converts an ISO8601 Datetime representation without timezone offset to an Epoch. If no time system is specified, than UTC is assumed. The T which separates the date from the time can be replaced with a single whitespace character (\W). The offset is also optional, cf. the examples below.

Example

use hifitime::Epoch;
let dt = Epoch::from_gregorian_utc(2017, 1, 14, 0, 31, 55, 0);
assert_eq!(
    dt,
    Epoch::from_gregorian_str("2017-01-14T00:31:55 UTC").unwrap()
);
assert_eq!(
    dt,
    Epoch::from_gregorian_str("2017-01-14T00:31:55.0000 UTC").unwrap()
);
assert_eq!(
    dt,
    Epoch::from_gregorian_str("2017-01-14T00:31:55").unwrap()
);
assert_eq!(
    dt,
    Epoch::from_gregorian_str("2017-01-14 00:31:55").unwrap()
);

pub fn as_gregorian_utc(self) -> (i32, u8, u8, u8, u8, u8, u32)[src]

Converts the Epoch to the Gregorian UTC equivalent as (year, month, day, hour, minute, second). WARNING: Nanoseconds are lost in this conversion!

Example

use hifitime::Epoch;
let dt_str = "2017-01-14T00:31:55 UTC";
let dt = Epoch::from_gregorian_str(dt_str).unwrap();
let (y, m, d, h, min, s, _) = dt.as_gregorian_utc();
assert_eq!(y, 2017);
assert_eq!(m, 1);
assert_eq!(d, 14);
assert_eq!(h, 0);
assert_eq!(min, 31);
assert_eq!(s, 55);
assert_eq!(dt_str, dt.as_gregorian_utc_str().to_owned());

pub fn as_gregorian_utc_str(self) -> String[src]

Converts the Epoch to UTC Gregorian in the ISO8601 format.

pub fn as_gregorian_tai(self) -> (i32, u8, u8, u8, u8, u8, u32)[src]

Converts the Epoch to the Gregorian TAI equivalent as (year, month, day, hour, minute, second). WARNING: Nanoseconds are lost in this conversion!

Example

use hifitime::Epoch;
let dt = Epoch::from_gregorian_tai_at_midnight(1972, 1, 1);
let (y, m, d, h, min, s, _) = dt.as_gregorian_tai();
assert_eq!(y, 1972);
assert_eq!(m, 1);
assert_eq!(d, 1);
assert_eq!(h, 0);
assert_eq!(min, 0);
assert_eq!(s, 0);

pub fn as_gregorian_tai_str(self) -> String[src]

Converts the Epoch to TAI Gregorian in the ISO8601 format with " TAI" appended to the string

pub fn as_gregorian_str(self, ts: TimeSystem) -> String[src]

Converts the Epoch to Gregorian in the provided time system and in the ISO8601 format with the time system appended to the string

Trait Implementations

impl Add<Duration> for Epoch[src]

type Output = Self

The resulting type after applying the + operator.

impl Add<TimeUnit> for Epoch[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<Duration> for Epoch[src]

impl AddAssign<TimeUnit> for Epoch[src]

impl Clone for Epoch[src]

impl Copy for Epoch[src]

impl Debug for Epoch[src]

impl Display for Epoch[src]

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

The default format of an epoch is in TAI

impl FromStr for Epoch[src]

type Err = Errors

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>[src]

Attempts to convert a string to an Epoch.

Format identifiers: + JD: Julian days + MJD: Modified Julian days + SEC: Seconds past a given epoch (e.g. SEC 17.2 TAI is 17.2 seconds past TAI Epoch)

Example

use hifitime::Epoch;
use std::str::FromStr;

assert!(Epoch::from_str("JD 2452312.500372511 TDB").is_ok());
assert!(Epoch::from_str("JD 2452312.500372511 ET").is_ok());
assert!(Epoch::from_str("JD 2452312.500372511 TAI").is_ok());
assert!(Epoch::from_str("MJD 51544.5 TAI").is_ok());
assert!(Epoch::from_str("SEC 0.5 TAI").is_ok());
assert!(Epoch::from_str("SEC 66312032.18493909 TDB").is_ok());

impl PartialEq<Epoch> for Epoch[src]

impl PartialOrd<Epoch> for Epoch[src]

impl StructuralPartialEq for Epoch[src]

impl Sub<Duration> for Epoch[src]

type Output = Self

The resulting type after applying the - operator.

impl Sub<Epoch> for Epoch[src]

type Output = Duration

The resulting type after applying the - operator.

impl Sub<TimeUnit> for Epoch[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<Duration> for Epoch[src]

impl SubAssign<TimeUnit> for Epoch[src]

Auto Trait Implementations

impl RefUnwindSafe for Epoch

impl Send for Epoch

impl Sync for Epoch

impl Unpin for Epoch

impl UnwindSafe for Epoch

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,