pub struct SystemTimeClock { /* private fields */ }Expand description
An implementation of LocalClock backed by std::time::SystemTime.
§A note on Time Travel
The time reported by std::time::SystemTime may be radically altered by
external factors, such as the system operator manually setting the global
system clock. If this happens, SystemTimeClock will also jump
forwards/backwards in time in-tandem, depending on how far the clock was
rolled back/forwards!
If this is something that concerns you, you might want to consider writing a
custom LocalClock implementation backed by something akin to Linux’s
CLOCK_BOOTTIME, which provides a stable monotonically increasing clock
resilient against host suspends / resumes, and not subject to unexpected
negative / positive time jumps.
Implementations§
Source§impl SystemTimeClock
impl SystemTimeClock
Sourcepub fn new(initial_delta: LocalClockDelta) -> SystemTimeClock
pub fn new(initial_delta: LocalClockDelta) -> SystemTimeClock
Create a new SystemTimeClock, set to the current SystemTime plus
initial_delta.