Struct cap_std::time::SystemClock
source · pub struct SystemClock(/* private fields */);Expand description
A reference to a system clock, useful for talking to external entities like the file system or other processes.
This does not directly correspond to anything in std, however its methods
correspond to methods in std::time::SystemTime.
Implementations§
source§impl SystemClock
impl SystemClock
sourcepub const UNIX_EPOCH: SystemTime = _
pub const UNIX_EPOCH: SystemTime = _
An anchor in time which can be used to create new SystemTime
instances or learn about where in time a SystemTime lies.
This corresponds to std::time::SystemTime::UNIX_EPOCH.
sourcepub const fn new(ambient_authority: AmbientAuthority) -> SystemClock
pub const fn new(ambient_authority: AmbientAuthority) -> SystemClock
Constructs a new instance of Self.
§Ambient Authority
This uses ambient authority to accesses clocks.
sourcepub fn now(&self) -> SystemTime
pub fn now(&self) -> SystemTime
Returns an instant corresponding to “now”.
This corresponds to std::time::SystemTime::now.
sourcepub fn elapsed(
&self,
system_time: SystemTime,
) -> Result<Duration, SystemTimeError>
pub fn elapsed( &self, system_time: SystemTime, ) -> Result<Duration, SystemTimeError>
Returns the amount of time elapsed since this instant was created.
This corresponds to std::time::SystemTime::elapsed.
Auto Trait Implementations§
impl Freeze for SystemClock
impl RefUnwindSafe for SystemClock
impl Send for SystemClock
impl Sync for SystemClock
impl Unpin for SystemClock
impl UnwindSafe for SystemClock
Blanket Implementations§
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
Mutably borrows from an owned value. Read more