torrust_tracker_clock::time_extent

Trait Make

source
pub trait Make<Clock>: Sized
where Clock: Time,
{ // Provided methods fn now(increment: &Base) -> Option<Result<TimeExtent, TryFromIntError>> { ... } fn now_after( increment: &Base, add_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>> { ... } fn now_before( increment: &Base, sub_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>> { ... } }
Expand description

A TimeExtent maker. It’s a clock base on time extents. It gives you the time in time extents.

Provided Methods§

source

fn now(increment: &Base) -> Option<Result<TimeExtent, TryFromIntError>>

It gives you the current time extent (with a certain increment) for the current time. It gets the current timestamp front the Clock.

For example:

  • If the base increment is 1 second, it will return a time extent whose duration is 1 second and whose multiplier is the the number of seconds since the Unix Epoch (time extent).
  • If the base increment is 1 minute, it will return a time extent whose duration is 60 seconds and whose multiplier is the number of minutes since the Unix Epoch (time extent).
source

fn now_after( increment: &Base, add_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>>

Same as now, but it will add an extra duration to the current time before calculating the time extent. It gives you a time extent for a time in the future.

source

fn now_before( increment: &Base, sub_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>>

Same as now, but it will subtract a duration to the current time before calculating the time extent. It gives you a time extent for a time in the past.

Object Safety§

This trait is not object safe.

Implementors§