pub struct Iso8601TimeNoSp(pub SystemTime);Expand description
A wall-clock time, encoded in ISO8601 format without an intervening space.
This represents a specific UTC instant (ie an instant in global civil time). But it may not be able to represent leap seconds.
The timezone is not included in the string representation; +0000 is implicit.
(Example: “2020-10-09T17:38:12”)
Tuple Fields§
§0: SystemTimeMethods from Deref<Target = SystemTime>§
pub const UNIX_EPOCH: SystemTime = UNIX_EPOCH
1.8.0 · Sourcepub fn duration_since(
&self,
earlier: SystemTime,
) -> Result<Duration, SystemTimeError>
Available on crate feature parse2 only.
pub fn duration_since( &self, earlier: SystemTime, ) -> Result<Duration, SystemTimeError>
parse2 only.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>
Available on crate feature parse2 only.
pub fn elapsed(&self) -> Result<Duration, SystemTimeError>
parse2 only.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>
Available on crate feature parse2 only.
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime>
parse2 only.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.
1.34.0 · Sourcepub fn checked_sub(&self, duration: Duration) -> Option<SystemTime>
Available on crate feature parse2 only.
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime>
parse2 only.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.
Trait Implementations§
Source§impl Clone for Iso8601TimeNoSp
impl Clone for Iso8601TimeNoSp
Source§fn clone(&self) -> Iso8601TimeNoSp
fn clone(&self) -> Iso8601TimeNoSp
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Iso8601TimeNoSp
impl Debug for Iso8601TimeNoSp
Source§impl Deref for Iso8601TimeNoSp
impl Deref for Iso8601TimeNoSp
Source§impl Display for Iso8601TimeNoSp
impl Display for Iso8601TimeNoSp
Source§impl From<Iso8601TimeNoSp> for SystemTime
impl From<Iso8601TimeNoSp> for SystemTime
Source§fn from(value: Iso8601TimeNoSp) -> Self
fn from(value: Iso8601TimeNoSp) -> Self
Source§impl From<SystemTime> for Iso8601TimeNoSp
impl From<SystemTime> for Iso8601TimeNoSp
Source§fn from(value: SystemTime) -> Self
fn from(value: SystemTime) -> Self
Source§impl FromStr for Iso8601TimeNoSp
impl FromStr for Iso8601TimeNoSp
Source§impl Hash for Iso8601TimeNoSp
impl Hash for Iso8601TimeNoSp
Source§impl Ord for Iso8601TimeNoSp
impl Ord for Iso8601TimeNoSp
Source§fn cmp(&self, other: &Iso8601TimeNoSp) -> Ordering
fn cmp(&self, other: &Iso8601TimeNoSp) -> 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 Iso8601TimeNoSp
impl PartialEq for Iso8601TimeNoSp
Source§impl PartialOrd for Iso8601TimeNoSp
impl PartialOrd for Iso8601TimeNoSp
impl Copy for Iso8601TimeNoSp
impl Eq for Iso8601TimeNoSp
impl NormalItemArgument for Iso8601TimeNoSp
impl StructuralPartialEq for Iso8601TimeNoSp
Auto Trait Implementations§
impl Freeze for Iso8601TimeNoSp
impl RefUnwindSafe for Iso8601TimeNoSp
impl Send for Iso8601TimeNoSp
impl Sync for Iso8601TimeNoSp
impl Unpin for Iso8601TimeNoSp
impl UnwindSafe for Iso8601TimeNoSp
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<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<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> 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> ItemArgumentParseable for Twhere
T: NormalItemArgument,
impl<T> ItemArgumentParseable for Twhere
T: NormalItemArgument,
Source§fn from_args<'s>(args: &mut ArgumentStream<'s>) -> Result<T, ArgumentError>
fn from_args<'s>(args: &mut ArgumentStream<'s>) -> Result<T, ArgumentError>
parse2 only.