pub struct Deadline { /* private fields */ }
Expand description
A point in time that acts as a deadline for an operation.
A deadline internally tracks both wall-clock time and, optionally, OS monotonic time. When two deadlines are compared, monotonic time is preferred, but if one or more deadlines do not have monotonic time, wall-clock time is used.
When a deadline is serialized, only its wall-clock time is serialized. The monotonic time is not useful outside of the process that generated it, since the monotonic time is not guaranteed to be consistent across processes.
Implementations§
Source§impl Deadline
impl Deadline
Sourcepub fn now() -> Deadline
pub fn now() -> Deadline
Returns a new deadline representing the current time.
This will capture both wall-clock time and monotonic time.
Sourcepub fn instant(&self) -> Option<Instant>
pub fn instant(&self) -> Option<Instant>
The monotonic OS instant of the deadline, if there is one.
Sourcepub fn system_time(&self) -> SystemTime
pub fn system_time(&self) -> SystemTime
The wall-clock time of the deadline.
Sourcepub fn checked_add(&self, duration: Duration) -> Option<Deadline>
pub fn checked_add(&self, duration: Duration) -> Option<Deadline>
Adds a duration to the deadline, returning None
on overflow.