1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use core::time::Duration;
use crate::syscall::{sys_read_clock_info, ClockSource, ReadClockFlags};
pub fn get_monotonic() -> Duration {
let clock_info = sys_read_clock_info(ClockSource::BestMonotonic, ReadClockFlags::empty())
.expect("failed to get monotonic time from kernel");
Duration::from(clock_info.current_value())
}
pub fn get_systemtime() -> Duration {
let clock_info = sys_read_clock_info(ClockSource::BestRealTime, ReadClockFlags::empty())
.expect("failed to get monotonic time from kernel");
Duration::from(clock_info.current_value())
}