pub struct ClockMark { /* private fields */ }Expand description
Highest system time ever seen, persisted. Detects a clock turned back to
stretch a time-limited licence. Recovery is correcting the clock; if the
clock had jumped into the future, the mark stays there until real time
passes it or ClockMark::reset is run.
Implementations§
Source§impl ClockMark
impl ClockMark
Sourcepub fn open(path: &Path, guard: Duration) -> Result<Self, LicenceError>
pub fn open(path: &Path, guard: Duration) -> Result<Self, LicenceError>
Open the mark file (missing = no mark yet). guard is the tolerated step
back (NTP corrections, a drifting RTC before sync).
Sourcepub fn check(&self, now: DateTime<Utc>) -> ClockStatus
pub fn check(&self, now: DateTime<Utc>) -> ClockStatus
Check now without persisting.
Sourcepub fn observe(
&mut self,
now: DateTime<Utc>,
) -> Result<ClockStatus, LicenceError>
pub fn observe( &mut self, now: DateTime<Utc>, ) -> Result<ClockStatus, LicenceError>
Check now and advance the mark if now is later.
Sourcepub fn reset(&mut self, now: DateTime<Utc>) -> Result<(), LicenceError>
pub fn reset(&mut self, now: DateTime<Utc>) -> Result<(), LicenceError>
Reset the mark to now — the service action after a clock that once
jumped into the future (faulty RTC or NTP): correcting the clock alone
does not lower a mark that was already advanced. Products must not make
this an operator setting, or it lifts every time-limited licence.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClockMark
impl RefUnwindSafe for ClockMark
impl Send for ClockMark
impl Sync for ClockMark
impl Unpin for ClockMark
impl UnwindSafe for ClockMark
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