pub struct SystemClock;Expand description
A clock implementation that uses the system’s wall clock time.
This is a zero-sized type (ZST) with no runtime overhead. It directly
queries the system for the current time whenever millis()
or time() is called.
§Note
The time returned by this clock is subject to system time adjustments,
such as NTP synchronization or manual changes. For monotonic time
measurements, use MonotonicClock instead.
§Thread Safety
This type is completely thread-safe as it has no mutable state.
§Examples
use prism3_clock::{Clock, SystemClock};
let clock = SystemClock::new();
let timestamp = clock.millis();
let time = clock.time();
println!("Current system time: {}", time);§Author
Haixing Hu
Implementations§
Trait Implementations§
Source§impl Clock for SystemClock
impl Clock for SystemClock
Source§impl Clone for SystemClock
impl Clone for SystemClock
Source§fn clone(&self) -> SystemClock
fn clone(&self) -> SystemClock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SystemClock
impl Debug for SystemClock
Source§impl Default for SystemClock
impl Default for SystemClock
Source§fn default() -> SystemClock
fn default() -> SystemClock
Returns the “default value” for a type. Read more
impl Copy for SystemClock
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