pub(crate) struct SystemTime(SystemTime);Expand description
A measurement of the system clock, useful for talking to external entities like the file system or other processes.
Distinct from the Instant type, this time measurement is not
monotonic. This means that you can save a file to the file system, then
save another file to the file system, and the second file has a
SystemTime measurement earlier than the first. In other words, an
operation that happens after another operation in real time may have an
earlier SystemTime!
Consequently, comparing two SystemTime instances to learn about the
duration between them returns a Result instead of an infallible Duration
to indicate that this sort of time drift may happen and needs to be handled.
Although a SystemTime cannot be directly inspected, the UNIX_EPOCH
constant is provided in this module as an anchor in time to learn
information about a SystemTime. By calculating the duration from this
fixed point in time, a SystemTime can be converted to a human-readable time,
or perhaps some other string representation.
The size of a SystemTime struct may vary depending on the target operating
system.
A SystemTime does not count leap seconds.
SystemTime::now()’s behavior around a leap second
is the same as the operating system’s wall clock.
The precise behavior near a leap second
(e.g. whether the clock appears to run slow or fast, or stop, or jump)
depends on platform and configuration,
so should not be relied on.
Example:
use std::time::{Duration, SystemTime};
use std::thread::sleep;
fn main() {
let now = SystemTime::now();
// we sleep for 2 seconds
sleep(Duration::new(2, 0));
match now.elapsed() {
Ok(elapsed) => {
// it prints '2'
println!("{}", elapsed.as_secs());
}
Err(e) => {
// the system clock went backwards!
println!("Great Scott! {e:?}");
}
}
}§Platform-specific behavior
The precision of SystemTime can depend on the underlying OS-specific time format.
For example, on Windows the time is represented in 100 nanosecond intervals whereas Linux
can represent nanosecond intervals.
The following system calls are currently being used by now() to find out
the current time:
| Platform | System call |
|---|---|
| SGX | insecure_time usercall. More information on timekeeping in SGX |
| UNIX | clock_gettime (Realtime Clock) |
| Darwin | clock_gettime (Realtime Clock) |
| VXWorks | clock_gettime (Realtime Clock) |
| SOLID | SOLID_RTC_ReadTime |
| WASI | __wasi_clock_time_get (Realtime Clock) |
| Windows | GetSystemTimePreciseAsFileTime / GetSystemTimeAsFileTime |
Disclaimer: These system calls might change over time.
Note: mathematical operations like
addmay panic if the underlying structure cannot represent the new point in time.
Tuple Fields§
§0: SystemTimeImplementations§
Source§impl SystemTime
impl SystemTime
1.28.0 · Sourcepub const UNIX_EPOCH: SystemTime = UNIX_EPOCH
pub const UNIX_EPOCH: SystemTime = UNIX_EPOCH
An anchor in time which can be used to create new SystemTime instances or
learn about where in time a SystemTime lies.
This constant is defined to be “1970-01-01 00:00:00 UTC” on all systems with
respect to the system clock. Using duration_since on an existing
SystemTime instance can tell how far away from this point in time a
measurement lies, and using UNIX_EPOCH + duration can be used to create a
SystemTime instance to represent another fixed point in time.
duration_since(UNIX_EPOCH).unwrap().as_secs() returns
the number of non-leap seconds since the start of 1970 UTC.
This is a POSIX time_t (as a u64),
and is the same time representation as used in many Internet protocols.
§Examples
use std::time::SystemTime;
match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()),
Err(_) => panic!("SystemTime before UNIX EPOCH!"),
}Sourcepub const MAX: SystemTime
🔬This is a nightly-only experimental API. (time_systemtime_limits)
pub const MAX: SystemTime
time_systemtime_limits)Represents the maximum value representable by SystemTime on this platform.
This value differs a lot between platforms, but it is always the case
that any positive addition of a Duration, whose value is greater
than or equal to the time precision of the operating system, to
SystemTime::MAX will fail.
§Examples
#![feature(time_systemtime_limits)]
use std::time::{Duration, SystemTime};
// Adding zero will change nothing.
assert_eq!(SystemTime::MAX.checked_add(Duration::ZERO), Some(SystemTime::MAX));
// But adding just one second will already fail ...
//
// Keep in mind that this in fact may succeed, if the Duration is
// smaller than the time precision of the operating system, which
// happens to be 1ns on most operating systems, with Windows being the
// notable exception by using 100ns, hence why this example uses 1s.
assert_eq!(SystemTime::MAX.checked_add(Duration::new(1, 0)), None);
// Utilize this for saturating arithmetic to improve error handling.
// In this case, we will use a certificate with a timestamp in the
// future as a practical example.
let configured_offset = Duration::from_secs(60 * 60 * 24);
let valid_after =
SystemTime::now()
.checked_add(configured_offset)
.unwrap_or(SystemTime::MAX);Sourcepub const MIN: SystemTime
🔬This is a nightly-only experimental API. (time_systemtime_limits)
pub const MIN: SystemTime
time_systemtime_limits)Represents the minimum value representable by SystemTime on this platform.
This value differs a lot between platforms, but it is always the case
that any positive subtraction of a Duration from, whose value is
greater than or equal to the time precision of the operating system, to
SystemTime::MIN will fail.
Depending on the platform, this may be either less than or equal to
SystemTime::UNIX_EPOCH, depending on whether the operating system
supports the representation of timestamps before the Unix epoch or not.
However, it is always guaranteed that a SystemTime::UNIX_EPOCH fits
between a SystemTime::MIN and SystemTime::MAX.
§Examples
#![feature(time_systemtime_limits)]
use std::time::{Duration, SystemTime};
// Subtracting zero will change nothing.
assert_eq!(SystemTime::MIN.checked_sub(Duration::ZERO), Some(SystemTime::MIN));
// But subtracting just one second will already fail.
//
// Keep in mind that this in fact may succeed, if the Duration is
// smaller than the time precision of the operating system, which
// happens to be 1ns on most operating systems, with Windows being the
// notable exception by using 100ns, hence why this example uses 1s.
assert_eq!(SystemTime::MIN.checked_sub(Duration::new(1, 0)), None);
// Utilize this for saturating arithmetic to improve error handling.
// In this case, we will use a cache expiry as a practical example.
let configured_expiry = Duration::from_secs(60 * 3);
let expiry_threshold =
SystemTime::now()
.checked_sub(configured_expiry)
.unwrap_or(SystemTime::MIN);1.8.0 · Sourcepub fn now() -> SystemTime
pub fn now() -> SystemTime
Returns the system time corresponding to “now”.
§Examples
use std::time::SystemTime;
let sys_time = SystemTime::now();1.8.0 · Sourcepub fn duration_since(
&self,
earlier: SystemTime,
) -> Result<Duration, SystemTimeError>
pub fn duration_since( &self, earlier: SystemTime, ) -> Result<Duration, SystemTimeError>
Returns the amount of time elapsed from an earlier point in time.
This function may fail because measurements taken earlier are not
guaranteed to always be before later measurements (due to anomalies such
as the system clock being adjusted either forwards or backwards).
Instant can be used to measure elapsed time without this risk of failure.
If successful, Ok(Duration) is returned where the duration represents
the amount of time elapsed from the specified measurement to this one.
Returns an Err if earlier is later than self, and the error
contains how far from self the time is.
§Examples
use std::time::SystemTime;
let sys_time = SystemTime::now();
let new_sys_time = SystemTime::now();
let difference = new_sys_time.duration_since(sys_time)
.expect("Clock may have gone backwards");
println!("{difference:?}");1.8.0 · Sourcepub fn elapsed(&self) -> Result<Duration, SystemTimeError>
pub fn elapsed(&self) -> Result<Duration, SystemTimeError>
Returns the difference from this system time to the current clock time.
This function may fail as the underlying system clock is susceptible to
drift and updates (e.g., the system clock could go backwards), so this
function might not always succeed. If successful, Ok(Duration) is
returned where the duration represents the amount of time elapsed from
this time measurement to the current time.
To measure elapsed time reliably, use Instant instead.
Returns an Err if self is later than the current system time, and
the error contains how far from the current system time self is.
§Examples
use std::thread::sleep;
use std::time::{Duration, SystemTime};
let sys_time = SystemTime::now();
let one_sec = Duration::from_secs(1);
sleep(one_sec);
assert!(sys_time.elapsed().unwrap() >= one_sec);1.34.0 · Sourcepub fn checked_add(&self, duration: Duration) -> Option<SystemTime>
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime>
Returns Some(t) where t is the time self + duration if t can be represented as
SystemTime (which means it’s inside the bounds of the underlying data structure), None
otherwise.
In the case that the duration is smaller than the time precision of the operating
system, Some(self) will be returned.
1.34.0 · Sourcepub fn checked_sub(&self, duration: Duration) -> Option<SystemTime>
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime>
Returns Some(t) where t is the time self - duration if t can be represented as
SystemTime (which means it’s inside the bounds of the underlying data structure), None
otherwise.
In the case that the duration is smaller than the time precision of the operating
system, Some(self) will be returned.
Sourcepub fn saturating_add(&self, duration: Duration) -> SystemTime
🔬This is a nightly-only experimental API. (time_saturating_systemtime)
pub fn saturating_add(&self, duration: Duration) -> SystemTime
time_saturating_systemtime)Saturating SystemTime addition, computing self + duration,
returning SystemTime::MAX if overflow occurred.
In the case that the duration is smaller than the time precision of
the operating system, self will be returned.
Sourcepub fn saturating_sub(&self, duration: Duration) -> SystemTime
🔬This is a nightly-only experimental API. (time_saturating_systemtime)
pub fn saturating_sub(&self, duration: Duration) -> SystemTime
time_saturating_systemtime)Saturating SystemTime subtraction, computing self - duration,
returning SystemTime::MIN if overflow occurred.
In the case that the duration is smaller than the time precision of
the operating system, self will be returned.
Sourcepub fn saturating_duration_since(&self, earlier: SystemTime) -> Duration
🔬This is a nightly-only experimental API. (time_saturating_systemtime)
pub fn saturating_duration_since(&self, earlier: SystemTime) -> Duration
time_saturating_systemtime)Saturating computation of time elapsed from an earlier point in time,
returning Duration::ZERO in the case that earlier is later or
equal to self.
§Examples
#![feature(time_saturating_systemtime)]
use std::time::{Duration, SystemTime};
let now = SystemTime::now();
let prev = now.saturating_sub(Duration::new(1, 0));
// now - prev should return non-zero.
assert_eq!(now.saturating_duration_since(prev), Duration::new(1, 0));
assert!(now.duration_since(prev).is_ok());
// prev - now should return zero (and fail with the non-saturating).
assert_eq!(prev.saturating_duration_since(now), Duration::ZERO);
assert!(prev.duration_since(now).is_err());
// now - now should return zero (and work with the non-saturating).
assert_eq!(now.saturating_duration_since(now), Duration::ZERO);
assert!(now.duration_since(now).is_ok());Trait Implementations§
1.8.0 · Source§impl Add<Duration> for SystemTime
impl Add<Duration> for SystemTime
Source§fn add(self, dur: Duration) -> SystemTime
fn add(self, dur: Duration) -> SystemTime
§Panics
This function may panic if the resulting point in time cannot be represented by the
underlying data structure. See SystemTime::checked_add for a version without panic.
Source§type Output = SystemTime
type Output = SystemTime
+ operator.Source§impl Add<Duration> for SystemTime
Available on crate feature std only.
impl Add<Duration> for SystemTime
std only.1.9.0 · Source§impl AddAssign<Duration> for SystemTime
impl AddAssign<Duration> for SystemTime
Source§fn add_assign(&mut self, other: Duration)
fn add_assign(&mut self, other: Duration)
+= operation. Read moreSource§impl AddAssign<Duration> for SystemTime
Available on crate feature std only.
impl AddAssign<Duration> for SystemTime
std only.Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
§Panics
This may panic if an overflow occurs.
1.8.0 · Source§impl Clone for SystemTime
impl Clone for SystemTime
Source§fn clone(&self) -> SystemTime
fn clone(&self) -> SystemTime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more1.8.0 · Source§impl Debug for SystemTime
impl Debug for SystemTime
Source§impl<'a> DecodeValue<'a> for SystemTime
Available on crate feature std only.
impl<'a> DecodeValue<'a> for SystemTime
std only.Source§fn decode_value<R>(reader: &mut R, header: Header) -> Result<SystemTime, Error>where
R: Reader<'a>,
fn decode_value<R>(reader: &mut R, header: Header) -> Result<SystemTime, Error>where
R: Reader<'a>,
Reader.Source§impl<'de> Deserialize<'de> for SystemTime
Available on crate feature std only.
impl<'de> Deserialize<'de> for SystemTime
std only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<SystemTime, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SystemTime, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl EncodeValue for SystemTime
Available on crate feature std only.
impl EncodeValue for SystemTime
std only.Source§impl FixedTag for SystemTime
Available on crate feature std only.
impl FixedTag for SystemTime
std only.Source§impl From<&DateTime> for SystemTime
Available on crate feature std only.
impl From<&DateTime> for SystemTime
std only.Source§fn from(time: &DateTime) -> SystemTime
fn from(time: &DateTime) -> SystemTime
Source§impl From<&GeneralizedTime> for SystemTime
Available on crate feature std only.
impl From<&GeneralizedTime> for SystemTime
std only.Source§fn from(time: &GeneralizedTime) -> SystemTime
fn from(time: &GeneralizedTime) -> SystemTime
Source§impl From<&Time> for SystemTime
Available on crate feature std only.
impl From<&Time> for SystemTime
std only.Source§fn from(time: &Time) -> SystemTime
fn from(time: &Time) -> SystemTime
Source§impl From<DateTime> for SystemTime
Available on crate feature std only.
impl From<DateTime> for SystemTime
std only.Source§fn from(time: DateTime) -> SystemTime
fn from(time: DateTime) -> SystemTime
Source§impl From<ExpiryHours> for SystemTime
impl From<ExpiryHours> for SystemTime
Source§fn from(value: ExpiryHours) -> SystemTime
fn from(value: ExpiryHours) -> SystemTime
Source§impl From<GeneralizedTime> for SystemTime
Available on crate feature std only.
impl From<GeneralizedTime> for SystemTime
std only.Source§fn from(time: GeneralizedTime) -> SystemTime
fn from(time: GeneralizedTime) -> SystemTime
Source§impl From<HttpDate> for SystemTime
impl From<HttpDate> for SystemTime
Source§fn from(v: HttpDate) -> SystemTime
fn from(v: HttpDate) -> SystemTime
Source§impl From<Iso8601TimeNoSp> for SystemTime
impl From<Iso8601TimeNoSp> for SystemTime
Source§fn from(self_: Iso8601TimeNoSp) -> SystemTime
fn from(self_: Iso8601TimeNoSp) -> SystemTime
Source§impl From<Iso8601TimeSlug> for SystemTime
impl From<Iso8601TimeSlug> for SystemTime
Source§fn from(value: Iso8601TimeSlug) -> SystemTime
fn from(value: Iso8601TimeSlug) -> SystemTime
Source§impl From<Iso8601TimeSp> for SystemTime
impl From<Iso8601TimeSp> for SystemTime
Source§fn from(self_: Iso8601TimeSp) -> SystemTime
fn from(self_: Iso8601TimeSp) -> SystemTime
Source§impl From<OffsetDateTime> for SystemTime
impl From<OffsetDateTime> for SystemTime
Source§fn from(datetime: OffsetDateTime) -> SystemTime
fn from(datetime: OffsetDateTime) -> SystemTime
§Panics
This may panic if the resulting SystemTime cannot be represented.
Source§impl From<Time> for SystemTime
Available on crate feature std only.
impl From<Time> for SystemTime
std only.Source§fn from(time: Time) -> SystemTime
fn from(time: Time) -> SystemTime
Source§impl From<Timestamp> for SystemTime
impl From<Timestamp> for SystemTime
Source§fn from(val: Timestamp) -> SystemTime
fn from(val: Timestamp) -> SystemTime
Source§impl From<UnixTime> for SystemTime
Available on crate feature std only.
impl From<UnixTime> for SystemTime
std only.Source§fn from(unix_time: UnixTime) -> SystemTime
fn from(unix_time: UnixTime) -> SystemTime
Source§impl From<UtcDateTime> for SystemTime
impl From<UtcDateTime> for SystemTime
Source§fn from(datetime: UtcDateTime) -> SystemTime
fn from(datetime: UtcDateTime) -> SystemTime
§Panics
This may panic if the resulting SystemTime cannot be represented.
Source§impl From<UtcTime> for SystemTime
Available on crate feature std only.
impl From<UtcTime> for SystemTime
std only.Source§fn from(utc_time: UtcTime) -> SystemTime
fn from(utc_time: UtcTime) -> SystemTime
1.8.0 · Source§impl Hash for SystemTime
impl Hash for SystemTime
1.8.0 · Source§impl Ord for SystemTime
impl Ord for SystemTime
Source§fn cmp(&self, other: &SystemTime) -> Ordering
fn cmp(&self, other: &SystemTime) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<OffsetDateTime> for SystemTime
impl PartialEq<OffsetDateTime> for SystemTime
Source§fn eq(&self, rhs: &OffsetDateTime) -> bool
fn eq(&self, rhs: &OffsetDateTime) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<SystemTime> for TrackingNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
impl PartialEq<SystemTime> for TrackingNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§impl PartialEq<SystemTime> for TrackingSystemTimeNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
impl PartialEq<SystemTime> for TrackingSystemTimeNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§impl PartialEq<TrackingNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
impl PartialEq<TrackingNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§impl PartialEq<TrackingSystemTimeNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
impl PartialEq<TrackingSystemTimeNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§fn eq(&self, t: &TrackingSystemTimeNow) -> bool
fn eq(&self, t: &TrackingSystemTimeNow) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<UtcDateTime> for SystemTime
impl PartialEq<UtcDateTime> for SystemTime
1.8.0 · Source§impl PartialEq for SystemTime
impl PartialEq for SystemTime
Source§fn eq(&self, other: &SystemTime) -> bool
fn eq(&self, other: &SystemTime) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd<OffsetDateTime> for SystemTime
impl PartialOrd<OffsetDateTime> for SystemTime
Source§impl PartialOrd<SystemTime> for TrackingNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
impl PartialOrd<SystemTime> for TrackingNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§impl PartialOrd<SystemTime> for TrackingSystemTimeNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
impl PartialOrd<SystemTime> for TrackingSystemTimeNow
Check if time t has been reached yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§impl PartialOrd<TrackingNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
impl PartialOrd<TrackingNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§impl PartialOrd<TrackingSystemTimeNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
impl PartialOrd<TrackingSystemTimeNow> for SystemTime
Check if we have reached time t yet (and if not, remember that we want to wake up then)
Always returns Some.
Source§impl PartialOrd<UtcDateTime> for SystemTime
impl PartialOrd<UtcDateTime> for SystemTime
1.8.0 · Source§impl PartialOrd for SystemTime
impl PartialOrd for SystemTime
Source§impl SaturatingTime for SystemTime
impl SaturatingTime for SystemTime
Source§fn max_value() -> Self
fn max_value() -> Self
Source§fn min_value() -> Self
fn min_value() -> Self
Source§fn saturating_add(self, duration: Duration) -> Self
fn saturating_add(self, duration: Duration) -> Self
Source§fn saturating_sub(self, duration: Duration) -> Self
fn saturating_sub(self, duration: Duration) -> Self
Source§fn saturating_duration_since(&self, earlier: Self) -> Duration
fn saturating_duration_since(&self, earlier: Self) -> Duration
Source§impl Serialize for SystemTime
Available on crate feature std only.
impl Serialize for SystemTime
std only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
1.8.0 · Source§impl Sub<Duration> for SystemTime
impl Sub<Duration> for SystemTime
Source§type Output = SystemTime
type Output = SystemTime
- operator.Source§impl Sub<Duration> for SystemTime
Available on crate feature std only.
impl Sub<Duration> for SystemTime
std only.Source§impl Sub<OffsetDateTime> for SystemTime
impl Sub<OffsetDateTime> for SystemTime
Source§fn sub(self, rhs: OffsetDateTime) -> <SystemTime as Sub<OffsetDateTime>>::Output
fn sub(self, rhs: OffsetDateTime) -> <SystemTime as Sub<OffsetDateTime>>::Output
§Panics
This may panic if an overflow occurs.
Source§impl Sub<UtcDateTime> for SystemTime
impl Sub<UtcDateTime> for SystemTime
Source§fn sub(self, rhs: UtcDateTime) -> <SystemTime as Sub<UtcDateTime>>::Output
fn sub(self, rhs: UtcDateTime) -> <SystemTime as Sub<UtcDateTime>>::Output
§Panics
This may panic if an overflow occurs.
1.9.0 · Source§impl SubAssign<Duration> for SystemTime
impl SubAssign<Duration> for SystemTime
Source§fn sub_assign(&mut self, other: Duration)
fn sub_assign(&mut self, other: Duration)
-= operation. Read moreSource§impl SubAssign<Duration> for SystemTime
Available on crate feature std only.
impl SubAssign<Duration> for SystemTime
std only.Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
§Panics
This may panic if an overflow occurs.
Source§impl SystemTimeExt for SystemTime
impl SystemTimeExt for SystemTime
Source§fn get() -> SystemTime
fn get() -> SystemTime
Source§impl SystemTimeExt for SystemTime
impl SystemTimeExt for SystemTime
Source§fn checked_add_signed(&self, duration: Duration) -> Option<SystemTime>
fn checked_add_signed(&self, duration: Duration) -> Option<SystemTime>
Duration to the SystemTime, returning None is the result cannot be
represented by the underlying data structure.Source§fn checked_sub_signed(&self, duration: Duration) -> Option<SystemTime>
fn checked_sub_signed(&self, duration: Duration) -> Option<SystemTime>
Duration from the SystemTime, returning None is the result
cannot be represented by the underlying data structure.Source§fn signed_duration_since(&self, earlier: SystemTime) -> Duration
fn signed_duration_since(&self, earlier: SystemTime) -> Duration
SystemTime to this one. This will be
negative if earlier is later than self. Read moreSource§impl<'a> TryFrom<AnyRef<'a>> for SystemTime
Available on crate feature std only.
impl<'a> TryFrom<AnyRef<'a>> for SystemTime
std only.Source§impl Update<SystemTime> for TrackingNow
impl Update<SystemTime> for TrackingNow
Source§fn update(&self, t: SystemTime)
fn update(&self, t: SystemTime)
t Read moreSource§impl Update<SystemTime> for TrackingSystemTimeNow
impl Update<SystemTime> for TrackingSystemTimeNow
Source§fn update(&self, t: SystemTime)
fn update(&self, t: SystemTime)
t Read moreimpl Copy for SystemTime
impl Eq for SystemTime
impl StructuralPartialEq for SystemTime
Auto Trait Implementations§
impl Freeze for SystemTime
impl RefUnwindSafe for SystemTime
impl Send for SystemTime
impl Sync for SystemTime
impl Unpin for SystemTime
impl UnsafeUnpin for SystemTime
impl UnwindSafe for SystemTime
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Encode for Twhere
T: EncodeValue + Tagged,
impl<T> Encode for Twhere
T: EncodeValue + Tagged,
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
Source§fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided Writer.
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PossiblyOption<T> for T
impl<T> PossiblyOption<T> for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.