pub struct UnixClock { /* private fields */ }Expand description
A Unix OS clock
Implementations§
Source§impl UnixClock
impl UnixClock
Sourcepub const CLOCK_REALTIME: Self
pub const CLOCK_REALTIME: Self
The standard realtime clock on unix systems.
use clock_steering::{Clock, unix::UnixClock};
fn main() -> std::io::Result<()> {
let clock = UnixClock::CLOCK_REALTIME;
let now = clock.now()?;
println!("{now:?}");
Ok(())
}Sourcepub const CLOCK_TAI: Self
pub const CLOCK_TAI: Self
TAI time on linux systems.
use clock_steering::{Clock, unix::UnixClock};
fn main() -> std::io::Result<()> {
let clock = UnixClock::CLOCK_TAI;
let now = clock.now()?;
println!("{now:?}");
Ok(())
}Trait Implementations§
Source§impl Clock for UnixClock
impl Clock for UnixClock
type Error = Error
Source§fn get_frequency(&self) -> Result<f64, Self::Error>
fn get_frequency(&self) -> Result<f64, Self::Error>
Get the frequency of the clock
The unit of the output is milliseconds (of drift) per second,
compared to the “natural” frequency of the clock.
Source§fn set_frequency(&self, frequency: f64) -> Result<Timestamp, Self::Error>
fn set_frequency(&self, frequency: f64) -> Result<Timestamp, Self::Error>
Change the frequency of the clock.
Returns the time at which the change was applied. Read more
Source§fn step_clock(&self, offset: TimeOffset) -> Result<Timestamp, Self::Error>
fn step_clock(&self, offset: TimeOffset) -> Result<Timestamp, Self::Error>
Change the current time of the clock by an offset.
Returns the time at which the change was applied.
Source§fn set_leap_seconds(
&self,
leap_status: LeapIndicator,
) -> Result<(), Self::Error>
fn set_leap_seconds( &self, leap_status: LeapIndicator, ) -> Result<(), Self::Error>
Change the indicators for upcoming leap seconds.
Source§fn error_estimate_update(
&self,
est_error: Duration,
max_error: Duration,
) -> Result<(), Self::Error>
fn error_estimate_update( &self, est_error: Duration, max_error: Duration, ) -> Result<(), Self::Error>
Provide the system with the current best estimates for the statistical
error of the clock, and the maximum deviation due to frequency error and
distance to the root clock.
impl Copy for UnixClock
Auto Trait Implementations§
impl Freeze for UnixClock
impl RefUnwindSafe for UnixClock
impl Send for UnixClock
impl Sync for UnixClock
impl Unpin for UnixClock
impl UnwindSafe for UnixClock
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