Skip to main content

ClockId

Trait ClockId 

Source
pub unsafe trait ClockId {
    const ID: clockid_t;

    // Required method
    fn ktime_get() -> ktime_t;
}
Expand description

Trait for kernel clock identifiers.

Selection of the clock depends on the use case. In some cases the usage of a particular clock is mandatory, e.g. in network protocols, filesystems. In other cases the user of the clock has to decide which clock is best suited for the purpose. In most scenarios clock Monotonic is the best choice as it provides a accurate monotonic notion of time (leap second smearing ignored).

§Safety

Implementers must ensure that ktime_get() returns a value in the inclusive range 0..=KTIME_MAX (i.e., greater than or equal to 0 and less than or equal to KTIME_MAX, where KTIME_MAX equals i64::MAX).

Required Associated Constants§

Source

const ID: clockid_t

The kernel clock ID associated with this clock.

This constant corresponds to the C side clockid_t value.

Required Methods§

Source

fn ktime_get() -> ktime_t

Get the current time from the clock.

The function must return a value in the range 0..=KTIME_MAX.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ClockId for BootTime

Source§

const ID: clockid_t

Source§

impl ClockId for Monotonic

Source§

const ID: clockid_t

Source§

impl ClockId for RealTime

Source§

const ID: clockid_t

Source§

impl ClockId for Tai

Source§

const ID: clockid_t