pub struct SystemTime(/* private fields */);std only.Expand description
๐
std
A measurement of the system clock.
๐phys/time/source re-exported from std::time
๐
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) |
| WASI | clock_gettime (Realtime Clock) |
| Darwin | clock_gettime (Realtime Clock) |
| VXWorks | clock_gettime (Realtime Clock) |
| SOLID | SOLID_RTC_ReadTime |
| 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.
Implementationsยง
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.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 BitSized<128> for SystemTime
impl BitSized<128> for SystemTime
Sourceยงconst BIT_SIZE: usize = _
const BIT_SIZE: usize = _
Sourceยงconst MIN_BYTE_SIZE: usize = _
const MIN_BYTE_SIZE: usize = _
Sourceยงfn bit_size(&self) -> usize
fn bit_size(&self) -> usize
Sourceยงfn min_byte_size(&self) -> usize
fn min_byte_size(&self) -> usize
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 moreimpl Copy for SystemTime
1.8.0 ยท Sourceยงimpl Debug for SystemTime
impl Debug for SystemTime
impl Eq for SystemTime
ยงimpl<'a> From<&'a Zoned> for SystemTime
impl<'a> From<&'a Zoned> for SystemTime
ยงfn from(time: &'a Zoned) -> SystemTime
fn from(time: &'a Zoned) -> SystemTime
ยงimpl From<Timestamp> for SystemTime
impl From<Timestamp> for SystemTime
ยงfn from(time: Timestamp) -> SystemTime
fn from(time: Timestamp) -> SystemTime
ยงimpl From<Zoned> for SystemTime
impl From<Zoned> for SystemTime
ยงfn from(time: Zoned) -> SystemTime
fn from(time: Zoned) -> 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,
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 ==.1.8.0 ยท Sourceยงimpl PartialOrd for SystemTime
impl PartialOrd for SystemTime
impl StructuralPartialEq for SystemTime
1.8.0 ยท Sourceยงimpl Sub<Duration> for SystemTime
impl Sub<Duration> for SystemTime
Sourceยงtype Output = SystemTime
type Output = SystemTime
- operator.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 TimePoint for SystemTime
impl TimePoint for SystemTime
Sourceยงfn time_elapsed_checked(later: Self, earlier: Self) -> Option<Self::Elapsed> โ
fn time_elapsed_checked(later: Self, earlier: Self) -> Option<Self::Elapsed> โ
earlier to later,
or None if it is not valid or not representable.Sourceยงfn time_elapsed(later: Self, earlier: Self) -> Self::Elapsed
fn time_elapsed(later: Self, earlier: Self) -> Self::Elapsed
Sourceยงimpl TimeSource<SystemTime> for SystemTime
impl TimeSource<SystemTime> for SystemTime
Sourceยงfn time_is_monotonic() -> bool
fn time_is_monotonic() -> bool
Sourceยงfn time_is_absolute() -> bool
fn time_is_absolute() -> bool
Sourceยงfn time_scale() -> TimeScale
fn time_scale() -> TimeScale
time_point_value
and time_elapsed_value.Sourceยงfn time_now() -> SystemTime
fn time_now() -> SystemTime
P.Sourceยงfn time_point_value(point: SystemTime) -> u64
fn time_point_value(point: SystemTime) -> u64
u64 value in time_scale units.Sourceยงfn time_elapsed_value(elapsed: Duration) -> u64
fn time_elapsed_value(elapsed: Duration) -> u64
u64 value in time_scale units.Sourceยงfn time_now_value() -> u64
fn time_now_value() -> u64
u64 value in time_scale units.Sourceยงfn time_elapsed_since(point: P) -> P::Elapsed
fn time_elapsed_since(point: P) -> P::Elapsed
point to now.Sourceยงfn time_elapsed_since_checked(point: P) -> Option<P::Elapsed> โ
fn time_elapsed_since_checked(point: P) -> Option<P::Elapsed> โ
point to now,
or None if it is not valid or not representable.Sourceยงfn time_elapsed_since_value(point: P) -> u64
fn time_elapsed_since_value(point: P) -> u64
Sourceยงfn time_point_seconds(point: P) -> u64
fn time_point_seconds(point: P) -> u64
point to seconds.Sourceยงfn time_point_millis(point: P) -> u64
fn time_point_millis(point: P) -> u64
point to milliseconds.Sourceยงfn time_point_micros(point: P) -> u64
fn time_point_micros(point: P) -> u64
point to microseconds.Sourceยงfn time_point_nanos(point: P) -> u64
fn time_point_nanos(point: P) -> u64
point to nanoseconds.Sourceยงfn time_elapsed_seconds(elapsed: P::Elapsed) -> u64
fn time_elapsed_seconds(elapsed: P::Elapsed) -> u64
elapsed to seconds.Sourceยงfn time_elapsed_millis(elapsed: P::Elapsed) -> u64
fn time_elapsed_millis(elapsed: P::Elapsed) -> u64
elapsed to milliseconds.Sourceยงfn time_elapsed_micros(elapsed: P::Elapsed) -> u64
fn time_elapsed_micros(elapsed: P::Elapsed) -> u64
elapsed to microseconds.Sourceยงfn time_elapsed_nanos(elapsed: P::Elapsed) -> u64
fn time_elapsed_nanos(elapsed: P::Elapsed) -> u64
elapsed to nanoseconds.Sourceยงfn time_now_seconds() -> u64
fn time_now_seconds() -> u64
Sourceยงfn time_now_millis() -> u64
fn time_now_millis() -> u64
Sourceยงfn time_now_micros() -> u64
fn time_now_micros() -> u64
Sourceยงfn time_now_nanos() -> u64
fn time_now_nanos() -> u64
Sourceยงfn time_now_millis_f64() -> f64
fn time_now_millis_f64() -> f64
f64.Sourceยงimpl TimeSource<u32> for SystemTime
Unix-time u32 projection of SystemTime in seconds.
impl TimeSource<u32> for SystemTime
Unix-time u32 projection of SystemTime in seconds.
This gives a compact absolute projection with a range of about 136 years from the Unix epoch, so it remains valid until February 2106.
Sourceยงfn time_is_monotonic() -> bool
fn time_is_monotonic() -> bool
Sourceยงfn time_is_absolute() -> bool
fn time_is_absolute() -> bool
Sourceยงfn time_scale() -> TimeScale
fn time_scale() -> TimeScale
time_point_value
and time_elapsed_value.Sourceยงfn time_point_value(point: u32) -> u64
fn time_point_value(point: u32) -> u64
u64 value in time_scale units.Sourceยงfn time_elapsed_value(elapsed: u32) -> u64
fn time_elapsed_value(elapsed: u32) -> u64
u64 value in time_scale units.Sourceยงfn time_now_value() -> u64
fn time_now_value() -> u64
u64 value in time_scale units.Sourceยงfn time_elapsed_since(point: P) -> P::Elapsed
fn time_elapsed_since(point: P) -> P::Elapsed
point to now.Sourceยงfn time_elapsed_since_checked(point: P) -> Option<P::Elapsed> โ
fn time_elapsed_since_checked(point: P) -> Option<P::Elapsed> โ
point to now,
or None if it is not valid or not representable.Sourceยงfn time_elapsed_since_value(point: P) -> u64
fn time_elapsed_since_value(point: P) -> u64
Sourceยงfn time_point_seconds(point: P) -> u64
fn time_point_seconds(point: P) -> u64
point to seconds.Sourceยงfn time_point_millis(point: P) -> u64
fn time_point_millis(point: P) -> u64
point to milliseconds.Sourceยงfn time_point_micros(point: P) -> u64
fn time_point_micros(point: P) -> u64
point to microseconds.Sourceยงfn time_point_nanos(point: P) -> u64
fn time_point_nanos(point: P) -> u64
point to nanoseconds.Sourceยงfn time_elapsed_seconds(elapsed: P::Elapsed) -> u64
fn time_elapsed_seconds(elapsed: P::Elapsed) -> u64
elapsed to seconds.Sourceยงfn time_elapsed_millis(elapsed: P::Elapsed) -> u64
fn time_elapsed_millis(elapsed: P::Elapsed) -> u64
elapsed to milliseconds.Sourceยงfn time_elapsed_micros(elapsed: P::Elapsed) -> u64
fn time_elapsed_micros(elapsed: P::Elapsed) -> u64
elapsed to microseconds.Sourceยงfn time_elapsed_nanos(elapsed: P::Elapsed) -> u64
fn time_elapsed_nanos(elapsed: P::Elapsed) -> u64
elapsed to nanoseconds.Sourceยงfn time_now_seconds() -> u64
fn time_now_seconds() -> u64
Sourceยงfn time_now_millis() -> u64
fn time_now_millis() -> u64
Sourceยงfn time_now_micros() -> u64
fn time_now_micros() -> u64
Sourceยงfn time_now_nanos() -> u64
fn time_now_nanos() -> u64
Sourceยงfn time_now_millis_f64() -> f64
fn time_now_millis_f64() -> f64
f64.Sourceยงimpl TimeSource<u64> for SystemTime
Unix-time u64 projection of SystemTime in nanoseconds.
impl TimeSource<u64> for SystemTime
Unix-time u64 projection of SystemTime in nanoseconds.
This is the canonical wide numeric projection:
At nanosecond resolution, u64 spans about 584 years.
Sourceยงfn time_is_monotonic() -> bool
fn time_is_monotonic() -> bool
Sourceยงfn time_is_absolute() -> bool
fn time_is_absolute() -> bool
Sourceยงfn time_scale() -> TimeScale
fn time_scale() -> TimeScale
time_point_value
and time_elapsed_value.Sourceยงfn time_point_value(point: u64) -> u64
fn time_point_value(point: u64) -> u64
u64 value in time_scale units.Sourceยงfn time_elapsed_value(elapsed: u64) -> u64
fn time_elapsed_value(elapsed: u64) -> u64
u64 value in time_scale units.Sourceยงfn time_now_value() -> u64
fn time_now_value() -> u64
u64 value in time_scale units.Sourceยงfn time_elapsed_since(point: P) -> P::Elapsed
fn time_elapsed_since(point: P) -> P::Elapsed
point to now.Sourceยงfn time_elapsed_since_checked(point: P) -> Option<P::Elapsed> โ
fn time_elapsed_since_checked(point: P) -> Option<P::Elapsed> โ
point to now,
or None if it is not valid or not representable.Sourceยงfn time_elapsed_since_value(point: P) -> u64
fn time_elapsed_since_value(point: P) -> u64
Sourceยงfn time_point_seconds(point: P) -> u64
fn time_point_seconds(point: P) -> u64
point to seconds.Sourceยงfn time_point_millis(point: P) -> u64
fn time_point_millis(point: P) -> u64
point to milliseconds.Sourceยงfn time_point_micros(point: P) -> u64
fn time_point_micros(point: P) -> u64
point to microseconds.Sourceยงfn time_point_nanos(point: P) -> u64
fn time_point_nanos(point: P) -> u64
point to nanoseconds.Sourceยงfn time_elapsed_seconds(elapsed: P::Elapsed) -> u64
fn time_elapsed_seconds(elapsed: P::Elapsed) -> u64
elapsed to seconds.Sourceยงfn time_elapsed_millis(elapsed: P::Elapsed) -> u64
fn time_elapsed_millis(elapsed: P::Elapsed) -> u64
elapsed to milliseconds.Sourceยงfn time_elapsed_micros(elapsed: P::Elapsed) -> u64
fn time_elapsed_micros(elapsed: P::Elapsed) -> u64
elapsed to microseconds.Sourceยงfn time_elapsed_nanos(elapsed: P::Elapsed) -> u64
fn time_elapsed_nanos(elapsed: P::Elapsed) -> u64
elapsed to nanoseconds.Sourceยงfn time_now_seconds() -> u64
fn time_now_seconds() -> u64
Sourceยงfn time_now_millis() -> u64
fn time_now_millis() -> u64
Sourceยงfn time_now_micros() -> u64
fn time_now_micros() -> u64
Sourceยงfn time_now_nanos() -> u64
fn time_now_nanos() -> u64
Sourceยงfn time_now_millis_f64() -> f64
fn time_now_millis_f64() -> f64
f64.ยงimpl TryFrom<SystemTime> for Timestamp
impl TryFrom<SystemTime> for Timestamp
ยงimpl TryFrom<SystemTime> for Zoned
impl TryFrom<SystemTime> for Zoned
Sourceยงimpl TryFrom<SystemTime> for TimeUnixI64
impl TryFrom<SystemTime> for TimeUnixI64
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<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.Sourceยงimpl<T, R> Morph<R> for Twhere
T: ?Sized,
impl<T, R> Morph<R> for Twhere
T: ?Sized,
Sourceยงimpl<T, P> TimeSourceCfg<P> for Twhere
T: TimeSource<P>,
P: TimePoint,
impl<T, P> TimeSourceCfg<P> for Twhere
T: TimeSource<P>,
P: TimePoint,
Sourceยงfn time_is_monotonic(_: ()) -> bool
fn time_is_monotonic(_: ()) -> bool
Sourceยงfn time_is_absolute(_: ()) -> bool
fn time_is_absolute(_: ()) -> bool
Sourceยงfn time_scale(_: ()) -> TimeScale
fn time_scale(_: ()) -> TimeScale
time_point_value and time_elapsed_value.Sourceยงfn time_point_value(_: (), point: P) -> u64
fn time_point_value(_: (), point: P) -> u64
u64 value in time_scale(cfg) units.Sourceยงfn time_elapsed_value(_: (), elapsed: <P as TimePoint>::Elapsed) -> u64
fn time_elapsed_value(_: (), elapsed: <P as TimePoint>::Elapsed) -> u64
u64 value in time_scale(cfg) units.Sourceยงfn time_now_millis(_: ()) -> u64
fn time_now_millis(_: ()) -> u64
Sourceยงfn time_now_micros(_: ()) -> u64
fn time_now_micros(_: ()) -> u64
Sourceยงfn time_now_nanos(_: ()) -> u64
fn time_now_nanos(_: ()) -> u64
Sourceยงfn time_now_millis_f64(_: ()) -> f64
fn time_now_millis_f64(_: ()) -> f64
f64.Sourceยงfn time_now_value(cfg: Self::Config) -> u64
fn time_now_value(cfg: Self::Config) -> u64
u64 value in time_scale units.Sourceยงfn time_elapsed_since(cfg: Self::Config, point: P) -> P::Elapsed
fn time_elapsed_since(cfg: Self::Config, point: P) -> P::Elapsed
point to now.Sourceยงfn time_elapsed_since_checked(cfg: Self::Config, point: P) -> Option<P::Elapsed> โ
fn time_elapsed_since_checked(cfg: Self::Config, point: P) -> Option<P::Elapsed> โ
point to now,
or None if it is not valid or not representable.Sourceยงfn time_elapsed_since_value(cfg: Self::Config, point: P) -> u64
fn time_elapsed_since_value(cfg: Self::Config, point: P) -> u64
Sourceยงfn time_point_seconds(cfg: Self::Config, point: P) -> u64
fn time_point_seconds(cfg: Self::Config, point: P) -> u64
point to seconds.Sourceยงfn time_point_millis(cfg: Self::Config, point: P) -> u64
fn time_point_millis(cfg: Self::Config, point: P) -> u64
point to milliseconds.Sourceยงfn time_point_micros(cfg: Self::Config, point: P) -> u64
fn time_point_micros(cfg: Self::Config, point: P) -> u64
point to microseconds.Sourceยงfn time_point_nanos(cfg: Self::Config, point: P) -> u64
fn time_point_nanos(cfg: Self::Config, point: P) -> u64
point to nanoseconds.Sourceยงfn time_elapsed_seconds(cfg: Self::Config, elapsed: P::Elapsed) -> u64
fn time_elapsed_seconds(cfg: Self::Config, elapsed: P::Elapsed) -> u64
elapsed to seconds.Sourceยงfn time_elapsed_millis(cfg: Self::Config, elapsed: P::Elapsed) -> u64
fn time_elapsed_millis(cfg: Self::Config, elapsed: P::Elapsed) -> u64
elapsed to milliseconds.Sourceยงfn time_elapsed_micros(cfg: Self::Config, elapsed: P::Elapsed) -> u64
fn time_elapsed_micros(cfg: Self::Config, elapsed: P::Elapsed) -> u64
elapsed to microseconds.Sourceยงfn time_elapsed_nanos(cfg: Self::Config, elapsed: P::Elapsed) -> u64
fn time_elapsed_nanos(cfg: Self::Config, elapsed: P::Elapsed) -> u64
elapsed to nanoseconds.