Struct nyx_space::md::ui::Epoch[][src]

pub struct Epoch(_);
Expand description

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

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

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

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

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

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

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

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

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.

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

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.

Returns this time in a Duration past J1900 counted in TAI

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

Returns the number of UTC seconds since the TAI epoch

Returns the number of UTC seconds since the TAI epoch

Returns the number of UTC days since the TAI epoch

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.

Returns the Modified Julian Date in seconds TAI.

Returns the Modified Julian Date in days UTC.

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

Returns the Modified Julian Date in seconds UTC.

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.

Returns the Julian seconds in TAI.

Returns the Julian days in UTC.

Returns the Julian seconds in UTC.

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

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

Returns the centuries pased J2000 TT

Returns the duration past J2000 TT

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

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

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

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

Returns the Ephemeris Time seconds past epoch

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)

Returns the Ephemeris Time JDE past epoch

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)

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()
);

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());

Converts the Epoch to UTC Gregorian in the ISO8601 format.

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);

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

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

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

WARNING: For speed, there is a possibility to add seconds directly to an Epoch. Using this is discouraged and should only be used if you have facing bottlenecks with the units.

The resulting type after applying the + operator.

Performs the += operation. Read more

Performs the += operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

The default format of an epoch is in TAI

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());

The associated error which can be returned from parsing.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

Tests if Self the same as the type T Read more

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.