Struct netsblox_vm::std_system::Clock
source · pub struct Clock { /* private fields */ }Expand description
A clock with optional coarse granularity.
Implementations§
source§impl Clock
impl Clock
sourcepub fn new(utc_offset: UtcOffset, cache_precision: Option<Precision>) -> Self
pub fn new(utc_offset: UtcOffset, cache_precision: Option<Precision>) -> Self
Creates a new Clock with the specified UtcOffset and (optional) cache Precision (see Clock::read).
sourcepub fn read(&self, precision: Precision) -> OffsetDateTime
pub fn read(&self, precision: Precision) -> OffsetDateTime
Reads the current time with the specified level of precision.
If caching was enabled by Clock::new, requests at or below the cache precision level will use the cached timestamp.
In any other case, the real current time is fetched by Clock::update and the result is stored in the cache if caching is enabled.
sourcepub fn update(&self) -> OffsetDateTime
pub fn update(&self) -> OffsetDateTime
Reads the real world time and stores the result in the cache if caching was enabled by Clock::new.
Auto Trait Implementations§
impl RefUnwindSafe for Clock
impl Send for Clock
impl Sync for Clock
impl Unpin for Clock
impl UnwindSafe for Clock
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