pub fn current_monotime() -> u64Expand description
https://linux.die.net/man/3/clock_gettime Monotonically increasing timestamp, incremented by 1 when the clock interrupt is triggered. This clock source is used by the bpf_ktime_get_ns function.
Examples found in repository?
examples/timestamp.rs (line 5)
4fn main() {
5 let ns = timestamp::current_monotime();
6 let mono = chrono::NaiveDateTime::from_timestamp(
7 (ns / 1000_000_000) as i64,
8 (ns % 1000_000_000) as u32,
9 );
10 let ns = timestamp::current_realtime();
11 let real = chrono::NaiveDateTime::from_timestamp(
12 (ns / 1000_000_000) as i64,
13 (ns % 1000_000_000) as u32,
14 );
15 let ns = timestamp::delta_of_mono_real_time();
16 let delta = chrono::NaiveDateTime::from_timestamp(
17 (ns / 1000_000_000) as i64,
18 (ns % 1000_000_000) as u32,
19 );
20
21 println!("monotonic time: {}", mono);
22 println!("real time: {}", real);
23 println!("delta time: {}", delta);
24}