pub struct StorageTime { /* private fields */ }Expand description
A provider storage time: Unix seconds and a nanosecond fraction (§20.5).
It keeps every returned digit on every platform, unlike SystemTime,
which counts 100 ns on Windows; ordering is time order.
Implementations§
Source§impl StorageTime
impl StorageTime
Sourcepub const UNIX_EPOCH: Self
pub const UNIX_EPOCH: Self
The Unix epoch, the earliest storage time.
Sourcepub fn new(seconds: u64, nanos: u32) -> Result<Self, Error>
pub fn new(seconds: u64, nanos: u32) -> Result<Self, Error>
A sample whose fraction is below one second.
Sourcepub fn from_system_time(time: SystemTime) -> Result<Self, Error>
pub fn from_system_time(time: SystemTime) -> Result<Self, Error>
The exact provider time, refusing one before the Unix epoch.
Sourcepub fn since_epoch(since: Duration) -> Self
pub fn since_epoch(since: Duration) -> Self
The time since the Unix epoch.
Sourcepub fn elapsed_since_epoch(self) -> Duration
pub fn elapsed_since_epoch(self) -> Duration
The exact time elapsed since the Unix epoch.
Sourcepub fn checked_add(self, duration: Duration) -> Option<Self>
pub fn checked_add(self, duration: Duration) -> Option<Self>
This time plus duration, or None past the representable range.
Sourcepub fn checked_sub(self, duration: Duration) -> Option<Self>
pub fn checked_sub(self, duration: Duration) -> Option<Self>
This time minus duration, or None before the Unix epoch.
Sourcepub fn duration_since(self, earlier: Self) -> Option<Duration>
pub fn duration_since(self, earlier: Self) -> Option<Duration>
The exact time from earlier to this time, or None if earlier is later.
Trait Implementations§
Source§impl Add<Duration> for StorageTime
Panics past the representable range, as SystemTime does; use
checked_add where the duration is not known to fit.
impl Add<Duration> for StorageTime
Panics past the representable range, as SystemTime does; use
checked_add where the duration is not known to fit.
Source§impl AddAssign<Duration> for StorageTime
impl AddAssign<Duration> for StorageTime
Source§fn add_assign(&mut self, duration: Duration)
fn add_assign(&mut self, duration: Duration)
+= operation. Read moreSource§impl Clone for StorageTime
impl Clone for StorageTime
Source§fn clone(&self) -> StorageTime
fn clone(&self) -> StorageTime
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StorageTime
impl Debug for StorageTime
Source§impl<'de> Deserialize<'de> for StorageTime
impl<'de> Deserialize<'de> for StorageTime
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for StorageTime
impl Hash for StorageTime
Source§impl Ord for StorageTime
impl Ord for StorageTime
Source§fn cmp(&self, other: &StorageTime) -> Ordering
fn cmp(&self, other: &StorageTime) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for StorageTime
impl PartialEq for StorageTime
Source§impl PartialOrd for StorageTime
impl PartialOrd for StorageTime
Source§impl Serialize for StorageTime
impl Serialize for StorageTime
Source§impl Sub<Duration> for StorageTime
Panics before the Unix epoch; use checked_sub where that can happen.
impl Sub<Duration> for StorageTime
Panics before the Unix epoch; use checked_sub where that can happen.