pub struct Clock {}
Expand description
The system clock
Implementations§
source§impl Clock
impl Clock
sourcepub fn current_time_rounded_to_seconds() -> Instant
pub fn current_time_rounded_to_seconds() -> Instant
Returns the current timestamp (in seconds)
sourcepub fn current_time_rounded_to_minutes() -> Instant
pub fn current_time_rounded_to_minutes() -> Instant
Returns the current timestamp (in seconds), rounded down to minutes
sourcepub fn current_time(precision: TimePrecision) -> Instant
pub fn current_time(precision: TimePrecision) -> Instant
Returns the current timestamp (in seconds), rounded down to the specified precision
sourcepub fn current_time_is_strictly_before(
instant: Instant,
precision: TimePrecision
) -> bool
pub fn current_time_is_strictly_before( instant: Instant, precision: TimePrecision ) -> bool
Returns true if current time, rounded down to a given precision, is strictly before the specified instant (also rounded down to a given precision), false otherwise.
sourcepub fn current_time_is_at_or_before(
instant: Instant,
precision: TimePrecision
) -> bool
pub fn current_time_is_at_or_before( instant: Instant, precision: TimePrecision ) -> bool
Returns true if current time, rounded down to a given precision, is before or equal to the specified instant (also rounded down to a given precision), false otherwise.
sourcepub fn current_time_is_strictly_after(
instant: Instant,
precision: TimePrecision
) -> bool
pub fn current_time_is_strictly_after( instant: Instant, precision: TimePrecision ) -> bool
Returns true if current time, rounded down to a given precision, is strictly after the specified instant (also rounded down to a given precision), false otherwise.
sourcepub fn current_time_is_at_or_after(
instant: Instant,
precision: TimePrecision
) -> bool
pub fn current_time_is_at_or_after( instant: Instant, precision: TimePrecision ) -> bool
Returns true if current time, rounded down to a given precision, is after or equal to the specified instant (also rounded down to a given precision), false otherwise.
sourcepub fn current_time_comparison(
instant: Instant,
precision: TimePrecision,
operator: TimeComparisonOperator
) -> bool
pub fn current_time_comparison( instant: Instant, precision: TimePrecision, operator: TimeComparisonOperator ) -> bool
Returns true if current time, rounded down to a given precision, matches the given comparison operator against the specified instant (also rounded down to a given precision), false otherwise.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Clock
impl Send for Clock
impl Sync for Clock
impl Unpin for Clock
impl UnwindSafe for Clock
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read more