pub fn sys_read_clock_list(
clock: ClockKind,
clocks: &mut [Clock],
start: u64,
flags: ReadClockListFlags,
) -> Result<usize, ReadClockListError>
Expand description
Discover a list of clock sources exposed by the kernel.
This returns a list of clocks stored in clocks
and the number of
entries filled. By default, one clock from every type of clock
exposed (ClockKind
), is returned. All information in ClockInfo
except the current value is also returned. For each type of clock with more
than one clock source, the first one is returned. Users can get a list of
all clocks, and thus all clock sources, for a particular type by
specifying the ClockKind
and setting the appropriate flag.
Users are expected to provide a slice, clocks
, to be filled by the kernel.
start
indicates what offset into the list of clocks the kernel should fill
the clocks
buffer from. When there are no more clocks to read from a given
start
offset, then the value 0 is returned.
ยงExamples
let mut clocks = [Clock::ZERO; 4];
let result = sys_read_clock_list(
ClockKind::Monotonic,
&mut clocks,
0,
ReadClockListFlags::FIRST_KIND,
);
if let Some(filled) = result {
if filled > 0 {
println!("time now: {}", clock[0].read().as_nanos());
}
}