pub struct Clock { /* private fields */ }Expand description
A millisecond clock that only moves when it is told to.
Implementations§
Source§impl Clock
impl Clock
Sourcepub fn refresh(&mut self)
pub fn refresh(&mut self)
Take a new reading, which a system clock does from the operating system and a fixed clock does not do at all.
Called once per turn of the shard loop, from the maintenance slice.
Sourcepub const fn set(&mut self, ms: u64)
pub const fn set(&mut self, ms: u64)
Move the clock to ms by hand.
On a system clock the next Clock::refresh will overwrite this, so it
is only meaningful on a fixed one.
Sourcepub fn fine_now_ms() -> u64
pub fn fine_now_ms() -> u64
Read the operating system’s clock right now.
A time before the unix epoch reads as zero rather than failing. There is nothing useful a database can do about a machine whose clock says 1969, and every key expiring immediately is a more honest outcome than a panic on a path that has no error to return.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Clock
impl RefUnwindSafe for Clock
impl Send for Clock
impl Sync for Clock
impl Unpin for Clock
impl UnsafeUnpin 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