Struct coarsetime::Date
source · pub struct Date(/* private fields */);Expand description
A representation of the current, actual date.
Implementations§
source§impl Date
impl Date
sourcepub fn now() -> Date
pub fn now() -> Date
Returns an instant corresponding to “now”
This function also updates the stored instant.
sourcepub fn update()
pub fn update()
Update the stored instant
This function should be called frequently, for example in an event loop
or using an Updater task.
sourcepub fn duration_since(&self, earlier: Date) -> Duration
pub fn duration_since(&self, earlier: Date) -> Duration
Returns the amount of time elapsed from another instant to this one
sourcepub fn elapsed_since_recent(&self) -> Duration
pub fn elapsed_since_recent(&self) -> Duration
Returns the amount of time elapsed between the this instant was created and the latest update
sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Returns the amount of time elapsed since this instant was created
This function also updates the stored instant.
sourcepub fn as_ticks(&self) -> u64
pub fn as_ticks(&self) -> u64
Return a representation of this instant as a number of “ticks”.
Note that length of a ‘tick’ is not guaranteed to represent
the same amount of time across different platforms, or from
one version of coarsetime to another.
Note also that the instant represented by “0” ticks is
unspecified. It is not guaranteed to be the same time across
different platforms, or from one version of coarsetime to
another.
This API is mainly intended for applications that need to
store the value of an Date in an
AtomicU64.
Trait Implementations§
source§impl AddAssign<Duration> for Date
impl AddAssign<Duration> for Date
source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+= operation. Read moresource§impl Ord for Date
impl Ord for Date
source§impl PartialEq<Date> for Date
impl PartialEq<Date> for Date
source§impl PartialOrd<Date> for Date
impl PartialOrd<Date> for Date
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 moresource§impl SubAssign<Duration> for Date
impl SubAssign<Duration> for Date
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-= operation. Read more