pub struct Clock { /* private fields */ }Expand description
Monotonic clock anchored to an observer-startup baseline.
Mirrors the semantics of Observer::start.elapsed().as_nanos() so
downstream stall arithmetic is unchanged when the operator does not
pass --clock-source.
Implementations§
Source§impl Clock
impl Clock
Sourcepub fn new(source: ClockSource) -> Result<Self, ClockError>
pub fn new(source: ClockSource) -> Result<Self, ClockError>
Build a Clock backed by source.
Performs one clock_gettime(2) call to anchor start_ns. Returns
ClockError::Unsupported when source = Boottime on a non-Linux
target.
Sourcepub fn probe(source: ClockSource) -> Result<(), ClockError>
pub fn probe(source: ClockSource) -> Result<(), ClockError>
One-call probe: surface Unsupported / OS errors at startup
before threading the clock through Observer.
Sourcepub fn now_ns(&self) -> u64
pub fn now_ns(&self) -> u64
Nanoseconds since this Clock’s baseline. Saturates to u64::MAX
on a wildly long-running process (>584 years).
Sourcepub fn source(&self) -> ClockSource
pub fn source(&self) -> ClockSource
Inspect the configured source (used by tests and by main.rs to
publish into the watchdog atomic).
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