Struct casper_types::Timestamp
source · pub struct Timestamp(/* private fields */);
Expand description
A timestamp type, representing a concrete moment in time.
Implementations§
source§impl Timestamp
impl Timestamp
sourcepub fn millis(&self) -> u64
pub fn millis(&self) -> u64
Returns the timestamp as the number of milliseconds since the Unix epoch
sourcepub fn saturating_diff(self, other: Timestamp) -> TimeDiff
pub fn saturating_diff(self, other: Timestamp) -> TimeDiff
Returns the difference between self
and other
, or 0
if self
is earlier than other
.
sourcepub fn saturating_sub(self, other: TimeDiff) -> Timestamp
pub fn saturating_sub(self, other: TimeDiff) -> Timestamp
Returns the difference between self
and other
, or 0
if that would be before the epoch.
sourcepub fn saturating_add(self, other: TimeDiff) -> Timestamp
pub fn saturating_add(self, other: TimeDiff) -> Timestamp
Returns the sum of self
and other
, or the maximum possible value if that would be
exceeded.
sourcepub fn trailing_zeros(&self) -> u8
pub fn trailing_zeros(&self) -> u8
Returns the number of trailing zeros in the number of milliseconds since the epoch.
Trait Implementations§
source§impl AddAssign<TimeDiff> for Timestamp
impl AddAssign<TimeDiff> for Timestamp
source§fn add_assign(&mut self, rhs: TimeDiff)
fn add_assign(&mut self, rhs: TimeDiff)
Performs the
+=
operation. Read moresource§impl Ord for Timestamp
impl Ord for Timestamp
source§impl PartialEq for Timestamp
impl PartialEq for Timestamp
source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl ToBytes for Timestamp
impl ToBytes for Timestamp
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Copy for Timestamp
impl Eq for Timestamp
impl StructuralEq for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
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