pub struct Timestamp<Timescale>(/* private fields */);Expand description
A timestamp in the scale Timescale.
Arithmetic on timestamps is implemented as wrapping.
The timescale ensures that arithmetic done with timescales is done with the correct timescale on both sides. This ensures that for example the following doesn’t compile:
ⓘ
let delta = Timestamp::<UTC>::from_seconds_nanos_since_unix_epoch(100, 0) - Timestamp::<TAI>::from_seconds_nanos_since_unix_epoch(50, 0);Implementations§
Source§impl<A> Timestamp<A>
impl<A> Timestamp<A>
Sourcepub const UNIX_EPOCH: Timestamp<A>
pub const UNIX_EPOCH: Timestamp<A>
Representation of the UNIX EPOCH in this timescale.
In other words: midnight on the first of januari 1970, as defined in the given timescale.
Sourcepub fn from_seconds_nanos_since_unix_epoch(
seconds: u64,
nanos: u32,
) -> Timestamp<A>
pub fn from_seconds_nanos_since_unix_epoch( seconds: u64, nanos: u32, ) -> Timestamp<A>
Create a new timestamp on the timescale, the given number of seconds and nanoseconds since the unix epoch.
Trait Implementations§
Source§impl<A> AddAssign<Duration> for Timestamp<A>
impl<A> AddAssign<Duration> for Timestamp<A>
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreimpl<A> Copy for Timestamp<A>
impl<A> Eq for Timestamp<A>
Auto Trait Implementations§
impl<Timescale> Freeze for Timestamp<Timescale>where
PhantomData<Timescale>: Freeze,
impl<Timescale> RefUnwindSafe for Timestamp<Timescale>where
PhantomData<Timescale>: RefUnwindSafe,
impl<Timescale> Send for Timestamp<Timescale>where
PhantomData<Timescale>: Send,
impl<Timescale> Sync for Timestamp<Timescale>where
PhantomData<Timescale>: Sync,
impl<Timescale> Unpin for Timestamp<Timescale>where
PhantomData<Timescale>: Unpin,
impl<Timescale> UnsafeUnpin for Timestamp<Timescale>where
PhantomData<Timescale>: UnsafeUnpin,
impl<Timescale> UnwindSafe for Timestamp<Timescale>where
PhantomData<Timescale>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more