pub trait SystemTimeExt: Sealed {
// Required methods
fn checked_add_signed(&self, duration: SignedDuration) -> Option<Self>;
fn checked_sub_signed(&self, duration: SignedDuration) -> Option<Self>;
fn signed_duration_since(&self, earlier: Self) -> SignedDuration;
}Available on crate feature
std only.Expand description
An extension trait for std::time::SystemTime that adds methods for
time::SignedDurations.
Required Methods§
Sourcefn checked_add_signed(&self, duration: SignedDuration) -> Option<Self>
fn checked_add_signed(&self, duration: SignedDuration) -> Option<Self>
Adds the given SignedDuration to the SystemTime, returning None is the result
cannot be represented by the underlying data structure.
Sourcefn checked_sub_signed(&self, duration: SignedDuration) -> Option<Self>
fn checked_sub_signed(&self, duration: SignedDuration) -> Option<Self>
Subtracts the given SignedDuration from the SystemTime, returning None is the
result cannot be represented by the underlying data structure.
Sourcefn signed_duration_since(&self, earlier: Self) -> SignedDuration
fn signed_duration_since(&self, earlier: Self) -> SignedDuration
Returns the amount of time elapsed from another SystemTime to this one. This will be
negative if earlier is later than self.
If the duration cannot be stored by SignedDuration, the value will be saturated to
SignedDuration::MIN or SignedDuration::MAX as appropriate.
§Example
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".