Struct rotor::Time [] [src]

pub struct Time(_);

The current time

This value is similar to (and directly derived from) the time::SteadyTime. But it has three important properties:

  1. It has a millisecond precision
  2. It's size is 8 bytes (SteadyTime is 16 bytes)
  3. It supports math with std::time::Duration (more future-proof)

The size of the value is important because we are going to have a lot of timeouts and lots of timestamps stored inside the state machines.

Precision of millisecond is good enough, and even better for our use case as it allows faster comparison and more frequent matches.

Warning: when adding a duration that is not a multiple of a millisecond we truncate (i.e. floor) the duration value. We may change this in future. Note that for timeouts this works well enough, as mio already bumps the timeout to at least a millisecond ahead.

Methods

impl Time

fn zero() -> Time

Zero time value, should be used only as a starting point for unit tests

Trait Implementations

impl Add<Duration> for Time

type Output = Time

fn add(self, rhs: Duration) -> Time

Derived Implementations

impl Ord for Time

fn cmp(&self, __arg_0: &Time) -> Ordering

impl PartialOrd for Time

fn partial_cmp(&self, __arg_0: &Time) -> Option<Ordering>

fn lt(&self, __arg_0: &Time) -> bool

fn le(&self, __arg_0: &Time) -> bool

fn gt(&self, __arg_0: &Time) -> bool

fn ge(&self, __arg_0: &Time) -> bool

impl Eq for Time

impl PartialEq for Time

fn eq(&self, __arg_0: &Time) -> bool

fn ne(&self, __arg_0: &Time) -> bool

impl Copy for Time

impl Clone for Time

fn clone(&self) -> Time

1.0.0fn clone_from(&mut self, source: &Self)

impl Debug for Time

fn fmt(&self, __arg_0: &mut Formatter) -> Result