Trait SystemTimeExt
pub trait SystemTimeExt: Sealed
An extension trait for std::time::SystemTime that adds methods for
time::SignedDurations.
Required Methods
fn checked_add_signed(&self, duration: SignedDuration) -> Option<Self>Adds the given
SignedDurationto theSystemTime, returningNoneis the result cannot be represented by the underlying data structure.fn checked_sub_signed(&self, duration: SignedDuration) -> Option<Self>Subtracts the given
SignedDurationfrom theSystemTime, returningNoneis the result cannot be represented by the underlying data structure.fn signed_duration_since(&self, earlier: Self) -> SignedDurationReturns the amount of time elapsed from another
SystemTimeto this one. This will be negative ifearlieris later thanself.If the duration cannot be stored by
SignedDuration, the value will be saturated toSignedDuration::MINorSignedDuration::MAXas appropriate.Example
# use SystemTime; # use ; let epoch = UNIX_EPOCH; let other = epoch + 1.seconds; assert_eq!; assert_eq!;
Implementors
impl SystemTimeExt for SystemTime