Struct concordium_std::Timestamp
source · #[repr(transparent)]pub struct Timestamp { /* private fields */ }
Expand description
Timestamp represented as milliseconds since unix epoch.
Timestamps from before January 1st 1970 at 00:00 are not supported.
Implementations§
source§impl Timestamp
impl Timestamp
sourcepub fn from_timestamp_millis(milliseconds: u64) -> Timestamp
pub fn from_timestamp_millis(milliseconds: u64) -> Timestamp
Construct timestamp from milliseconds since unix epoch.
sourcepub fn timestamp_millis(&self) -> u64
pub fn timestamp_millis(&self) -> u64
Milliseconds since the UNIX epoch.
sourcepub fn checked_add(self, duration: Duration) -> Option<Timestamp>
pub fn checked_add(self, duration: Duration) -> Option<Timestamp>
Add duration to the timestamp. Returns None
if the resulting timestamp
is not representable, i.e., too far in the future.
sourcepub fn checked_sub(self, duration: Duration) -> Option<Timestamp>
pub fn checked_sub(self, duration: Duration) -> Option<Timestamp>
Subtract duration from the timestamp. Returns None
instead of
overflowing if the resulting timestamp would be before the Unix
epoch.
sourcepub fn duration_between(self, other: Timestamp) -> Duration
pub fn duration_between(self, other: Timestamp) -> Duration
Compute the duration between the self and another timestamp. The duration is always positive, and is the difference between the the more recent timestamp and the one further in the past.
sourcepub fn duration_since(self, before: Timestamp) -> Option<Duration>
pub fn duration_since(self, before: Timestamp) -> Option<Duration>
Compute duration since a given timestamp. Returns None
if given time
is in the future compared to self.
Trait Implementations§
source§impl Ord for Timestamp
impl Ord for Timestamp
source§impl PartialEq<Timestamp> for Timestamp
impl PartialEq<Timestamp> for Timestamp
source§impl PartialOrd<Timestamp> for Timestamp
impl PartialOrd<Timestamp> for Timestamp
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl 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
source§impl<D, S> DeserialWithState<S> for Dwhere
D: Deserial,
S: HasStateApi,
impl<D, S> DeserialWithState<S> for Dwhere D: Deserial, S: HasStateApi,
source§fn deserial_with_state<R>(_state: &S, source: &mut R) -> Result<D, ParseError>where
R: Read,
fn deserial_with_state<R>(_state: &S, source: &mut R) -> Result<D, ParseError>where R: Read,
source§impl<T, S> StateClone<S> for Twhere
T: Clone,
impl<T, S> StateClone<S> for Twhere T: Clone,
source§unsafe fn clone_state(&self, _cloned_state_api: &S) -> T
unsafe fn clone_state(&self, _cloned_state_api: &S) -> T
cloned_state_api
. Read more