Struct irox_time::epoch::Timestamp

source ·
pub struct Timestamp<T> { /* private fields */ }
Expand description

Represents a Duration offset from a particular Epoch

Implementations§

source§

impl<T> Timestamp<T>

source

pub fn get_epoch(&self) -> Epoch

Returns the base epoch for this timestamp

source

pub fn get_offset(&self) -> Duration

Returns the relative offset of this timestamp from the specified epoch.

source§

impl Timestamp<UnixEpoch>

source

pub fn now() -> UnixTimestamp

Returns the local system clock equivalent of the unix timestamp

source

pub fn elapsed(&self) -> Duration

Returns the local system clock duration since the timestamp. MAY BE NEGATIVE if the clock has changed since the last call.

source

pub fn as_date(&self) -> Date

Returns this timestamp as a Date

source§

impl Timestamp<UnixEpoch>

source

pub const fn from_offset(offset: Duration) -> UnixTimestamp

Creates a new timestamp given the specified offset

source

pub const fn from_seconds(seconds: u32) -> UnixTimestamp

Creates a new timestamp given the specified number of seconds

source

pub const fn from_seconds_f64(seconds: f64) -> UnixTimestamp

Creates a new timestamp given the specified number of fractional seconds

source§

impl Timestamp<GPSEpoch>

source

pub const fn from_offset(offset: Duration) -> GPSTimestamp

Creates a new timestamp given the specified offset

source

pub const fn from_seconds(seconds: u32) -> GPSTimestamp

Creates a new timestamp given the specified number of seconds

source

pub const fn from_seconds_f64(seconds: f64) -> GPSTimestamp

Creates a new timestamp given the specified number of fractional seconds

source§

impl Timestamp<GregorianEpoch>

source

pub const fn from_offset(offset: Duration) -> GregorianTimestamp

Creates a new timestamp given the specified offset

source

pub const fn from_seconds(seconds: u32) -> GregorianTimestamp

Creates a new timestamp given the specified number of seconds

source

pub const fn from_seconds_f64(seconds: f64) -> GregorianTimestamp

Creates a new timestamp given the specified number of fractional seconds

source§

impl Timestamp<WindowsEpoch>

source

pub const fn from_offset(offset: Duration) -> WindowsNTTimestamp

Creates a new timestamp given the specified offset

source

pub const fn from_seconds(seconds: u32) -> WindowsNTTimestamp

Creates a new timestamp given the specified number of seconds

source

pub const fn from_seconds_f64(seconds: f64) -> WindowsNTTimestamp

Creates a new timestamp given the specified number of fractional seconds

source§

impl Timestamp<PrimeEpoch>

source

pub const fn from_offset(offset: Duration) -> PrimeTimestamp

Creates a new timestamp given the specified offset

source

pub const fn from_seconds(seconds: u32) -> PrimeTimestamp

Creates a new timestamp given the specified number of seconds

source

pub const fn from_seconds_f64(seconds: f64) -> PrimeTimestamp

Creates a new timestamp given the specified number of fractional seconds

Trait Implementations§

source§

impl<T> Add<&Duration> for Timestamp<T>

§

type Output = Timestamp<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Duration) -> Self::Output

Performs the + operation. Read more
source§

impl<T> Add<Duration> for Timestamp<T>

§

type Output = Timestamp<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Duration) -> Self::Output

Performs the + operation. Read more
source§

impl<T> AddAssign<&Duration> for Timestamp<T>

source§

fn add_assign(&mut self, rhs: &Duration)

Performs the += operation. Read more
source§

impl<T> AddAssign<Duration> for Timestamp<T>

source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
source§

impl<T: Clone> Clone for Timestamp<T>

source§

fn clone(&self) -> Timestamp<T>

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<T: Debug> Debug for Timestamp<T>

source§

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

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

impl From<&Timestamp<UnixEpoch>> for Date

source§

fn from(value: &UnixTimestamp) -> Self

Converts to this type from the input type.
source§

impl From<&Timestamp<UnixEpoch>> for UTCDateTime

source§

fn from(value: &UnixTimestamp) -> Self

Converts to this type from the input type.
source§

impl From<Timestamp<UnixEpoch>> for JulianDate

source§

fn from(value: UnixTimestamp) -> Self

Converts to this type from the input type.
source§

impl From<Timestamp<UnixEpoch>> for UTCDateTime

source§

fn from(value: UnixTimestamp) -> Self

Converts to this type from the input type.
source§

impl<T: PartialEq> PartialEq for Timestamp<T>

source§

fn eq(&self, other: &Timestamp<T>) -> 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<T> Sub<&Duration> for Timestamp<T>

§

type Output = Timestamp<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T> Sub<&Timestamp<T>> for Timestamp<T>

§

type Output = Duration

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Timestamp<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T> Sub<Duration> for Timestamp<T>

§

type Output = Timestamp<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Duration) -> Self::Output

Performs the - operation. Read more
source§

impl<T> Sub for Timestamp<T>

§

type Output = Duration

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Timestamp<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T> SubAssign<&Duration> for Timestamp<T>

source§

fn sub_assign(&mut self, rhs: &Duration)

Performs the -= operation. Read more
source§

impl<T> SubAssign<Duration> for Timestamp<T>

source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
source§

impl<T: Copy> Copy for Timestamp<T>

source§

impl<T> StructuralPartialEq for Timestamp<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Timestamp<T>
where T: RefUnwindSafe,

§

impl<T> Send for Timestamp<T>
where T: Send,

§

impl<T> Sync for Timestamp<T>
where T: Sync,

§

impl<T> Unpin for Timestamp<T>
where T: Unpin,

§

impl<T> UnwindSafe for Timestamp<T>
where T: UnwindSafe,

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> MaybeInto<U> for T
where U: MaybeFrom<T>,

source§

fn maybe_into(self) -> Option<U>

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.