Trait ClockSource

Source
pub trait ClockSource {
    const ID: clockid_t;

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

Trait for clock sources.

Selection of the clock source 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).

Required Associated Constants§

Source

const ID: clockid_t

The kernel clock ID associated with this clock source.

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 source.

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ClockSource for BootTime

Source§

const ID: clockid_t = 7i32

Source§

impl ClockSource for Monotonic

Source§

const ID: clockid_t = 1i32

Source§

impl ClockSource for RealTime

Source§

const ID: clockid_t = 0i32

Source§

impl ClockSource for Tai

Source§

const ID: clockid_t = 11i32