Skip to main content

Timestamp

Struct 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 const fn new(epoch: Epoch, duration: Duration) -> Self

Source

pub const fn get_epoch(&self) -> Epoch

Returns the base epoch for this timestamp

Source

pub const 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

Available on crate feature std only.

Returns the local system clock equivalent of the unix timestamp

Source

pub fn elapsed(&self) -> Duration

Available on crate feature std only.

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

pub fn as_julian(&self) -> JulianDate

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

Source§

impl Timestamp<Leapoch>

Source

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

Creates a new timestamp given the specified offset

Source

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

Creates a new timestamp given the specified number of seconds

Source

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

Creates a new timestamp given the specified number of fractional seconds

Source§

impl Timestamp<Vicintipoch>

Source

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

Creates a new timestamp given the specified offset

Source

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

Creates a new timestamp given the specified number of seconds

Source

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

Creates a new timestamp given the specified number of fractional seconds

Trait Implementations§

Source§

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

Source§

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 &mut Timestamp<T>

Source§

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>

Source§

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<&mut Duration> for &Timestamp<T>

Source§

type Output = Timestamp<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = Timestamp<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = Timestamp<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

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 &mut Timestamp<T>

Source§

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>

Source§

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 duplicate 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<T> From<&Time128> for Timestamp<T>

Source§

fn from(value: &Time128) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Time32> for Timestamp<T>

Source§

fn from(value: &Time32) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Time64> for Timestamp<T>

Source§

fn from(value: &Time64) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Timestamp<T>> for Time128

Source§

fn from(value: &Timestamp<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Timestamp<T>> for Time32

Source§

fn from(value: &Timestamp<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Timestamp<T>> for Time64

Source§

fn from(value: &Timestamp<T>) -> Self

Converts to this type from the input type.
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<T> From<&mut Time128> for Timestamp<T>

Source§

fn from(value: &mut Time128) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&mut Time32> for Timestamp<T>

Source§

fn from(value: &mut Time32) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&mut Time64> for Timestamp<T>

Source§

fn from(value: &mut Time64) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&mut Timestamp<T>> for Time128

Source§

fn from(value: &mut Timestamp<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&mut Timestamp<T>> for Time32

Source§

fn from(value: &mut Timestamp<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&mut Timestamp<T>> for Time64

Source§

fn from(value: &mut Timestamp<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Time128> for Timestamp<T>

Source§

fn from(value: Time128) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Time32> for Timestamp<T>

Source§

fn from(value: Time32) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Time64> for Timestamp<T>

Source§

fn from(value: Time64) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Timestamp<T>> for Time128

Source§

fn from(value: Timestamp<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Timestamp<T>> for Time32

Source§

fn from(value: Timestamp<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Timestamp<T>> for Time64

Source§

fn from(value: Timestamp<T>) -> 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> Ord for Timestamp<T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> PartialEq for Timestamp<T>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialOrd for Timestamp<T>

Source§

fn partial_cmp(&self, other: &Self) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

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

Source§

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<&Duration> for &mut Timestamp<T>

Source§

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<&Duration> for Timestamp<T>

Source§

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>

Source§

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<&Timestamp<T>> for &mut Timestamp<T>

Source§

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<&Timestamp<T>> for Timestamp<T>

Source§

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<&mut Duration> for &Timestamp<T>

Source§

type Output = Timestamp<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Timestamp<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Timestamp<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

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<Duration> for &mut Timestamp<T>

Source§

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<Duration> for Timestamp<T>

Source§

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>

Source§

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<Timestamp<T>> for &mut Timestamp<T>

Source§

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

Source§

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<&mut Duration> for Timestamp<T>

Source§

fn sub_assign(&mut self, rhs: &mut 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> Eq for Timestamp<T>

Auto Trait Implementations§

§

impl<T> Freeze for Timestamp<T>

§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,