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
[src]

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

Trait Implementations

impl Debug for Time
[src]

Formats the value using the given formatter.

impl Clone for Time
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Time
[src]

impl PartialEq for Time
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Time
[src]

impl PartialOrd for Time
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Time
[src]

This method returns an Ordering between self and other. Read more

impl Add<Duration> for Time
[src]

The resulting type after applying the + operator

The method for the + operator