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:
- It has a millisecond precision
- It's size is 8 bytes (SteadyTime is 16 bytes)
- 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.