Struct sbp::time::GpsTime

source ·
pub struct GpsTime(/* private fields */);
Expand description

Representation of GPS Time

Implementations§

source§

impl GpsTime

source

pub fn new(wn: i16, tow: f64) -> Result<GpsTime, InvalidGpsTime>

Makes a new GPS time object and checks the validity of the given values.

Invalid values include negative week values, negative, non-finite, or to large time of week values.

source

pub fn wn(&self) -> i16

Gets the week number

source

pub fn tow(&self) -> f64

Gets the time of week

source

pub fn is_valid(&self) -> bool

Checks if the stored time is valid

source

pub fn add_duration(&mut self, duration: &Duration)

Adds a duration to the time

source

pub fn subtract_duration(&mut self, duration: &Duration)

Subtracts a duration from the time

source

pub fn diff(&self, other: &GpsTime) -> f64

Gets the difference between this and another time value in seconds

source

pub fn to_utc(self, utc_params: &UtcParams) -> UtcTime

Converts the GPS time into UTC time

§Panics

This function will panic if the GPS time is not valid

source

pub fn to_utc_hardcoded(self) -> UtcTime

Converts the GPS time into UTC time using the hardcoded list of leap seconds.

§⚠️ 🦘 ⏱ ⚠️ - Leap Seconds

The hard coded list of leap seconds will get out of date, it is preferable to use GpsTime::to_utc() with the newest set of UTC parameters

§Panics

This function will panic if the GPS time is not valid

source

pub fn utc_offset(&self, utc_params: &UtcParams) -> f64

Gets the number of seconds difference between GPS and UTC times

source

pub fn utc_offset_hardcoded(&self) -> f64

Gets the number of seconds difference between GPS and UTC using the hardcoded list of leap seconds

§⚠️ 🦘 ⏱ ⚠️ - Leap Seconds

The hard coded list of leap seconds will get out of date, it is preferable to use GpsTime::utc_offset() with the newest set of UTC parameters

source

pub fn is_leap_second_event(&self, utc_params: &UtcParams) -> bool

Checks to see if this point in time is a UTC leap second event

source

pub fn is_leap_second_event_hardcoded(&self) -> bool

Checks to see if this point in time is a UTC leap second event using the hardcoded list of leap seconds

§⚠️ 🦘 ⏱ ⚠️ - Leap Seconds

The hard coded list of leap seconds will get out of date, it is preferable to use GpsTime::is_leap_second_event() with the newest set of UTC parameters

source

pub fn round_to_epoch(&self, soln_freq: f64) -> GpsTime

Gets the GPS time of the nearest solution epoch

source

pub fn floor_to_epoch(&self, soln_freq: f64) -> GpsTime

Gets the GPS time of the previous solution epoch

source

pub fn to_gal(self) -> GalTime

Converts the GPS time into Galileo time

§Panics

This function will panic if the GPS time is before the start of Galileo time, i.e. GAL_TIME_START

source

pub fn to_bds(self) -> BdsTime

Converts the GPS time into Beidou time

§Panics

This function will panic if the GPS time is before the start of Beidou time, i.e. BDS_TIME_START

source

pub fn to_glo(self, utc_params: &UtcParams) -> GloTime

Converts a GPS time into a Glonass time

§Panics

This function will panic if the GPS time is before the start of Glonass time, i.e. GLO_TIME_START

source

pub fn to_glo_hardcoded(self) -> GloTime

Converts a GPS time into a Glonass time using the hardcoded list of leap seconds.

§⚠️ 🦘 ⏱ ⚠️ - Leap Seconds

The hard coded list of leap seconds will get out of date, it is preferable to use GpsTime::to_glo() with the newest set of UTC parameters

§Panics

This function will panic if the GPS time is before the start of Glonass time, i.e. GLO_TIME_START

source

pub fn total_cmp(&self, other: &GpsTime) -> Ordering

Compare between itself and other GpsTime Checks whether week number is same which then mirrors f64::total_cmp()

Trait Implementations§

source§

impl Add<Duration> for GpsTime

§

type Output = GpsTime

The resulting type after applying the + operator.
source§

fn add(self, rhs: Duration) -> GpsTime

Performs the + operation. Read more
source§

impl AddAssign<Duration> for GpsTime

source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
source§

impl Clone for GpsTime

source§

fn clone(&self) -> GpsTime

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for GpsTime

source§

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

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

impl From<BdsTime> for GpsTime

source§

fn from(bds: BdsTime) -> GpsTime

Converts to this type from the input type.
source§

impl From<GalTime> for GpsTime

source§

fn from(gal: GalTime) -> GpsTime

Converts to this type from the input type.
source§

impl From<GpsTime> for BaseTime

source§

fn from(gps_time: GpsTime) -> Self

Converts to this type from the input type.
source§

impl From<GpsTime> for RoverTime

source§

fn from(gps_time: GpsTime) -> Self

Converts to this type from the input type.
source§

impl PartialEq for GpsTime

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for GpsTime

source§

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

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

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

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

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

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

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

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

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

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

impl Sub<&GpsTime> for GpsTime

§

type Output = Duration

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &GpsTime) -> Duration

Performs the - operation. Read more
source§

impl Sub<Duration> for GpsTime

§

type Output = GpsTime

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Duration) -> <GpsTime as Sub<Duration>>::Output

Performs the - operation. Read more
source§

impl Sub for GpsTime

§

type Output = Duration

The resulting type after applying the - operator.
source§

fn sub(self, rhs: GpsTime) -> Duration

Performs the - operation. Read more
source§

impl SubAssign<Duration> for GpsTime

source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
source§

impl TryFrom<GpsTime> for GpsTime

§

type Error = InvalidGpsTime

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

fn try_from(msg: GpsTime) -> Result<GpsTime, InvalidGpsTime>

Performs the conversion.
source§

impl TryFrom<GpsTimeSec> for GpsTime

§

type Error = InvalidGpsTime

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

fn try_from(msg: GpsTimeSec) -> Result<GpsTime, InvalidGpsTime>

Performs the conversion.
source§

impl Copy for GpsTime

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

§

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

§

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.