Skip to main content

zelos_trace/
time.rs

1use std::time::{SystemTime, UNIX_EPOCH};
2
3/// Get the current time as nanoseconds from epoch
4/// Panics on clock going backwards
5pub fn now_time_ns() -> i64 {
6    SystemTime::now()
7        .duration_since(UNIX_EPOCH)
8        .unwrap_or_else(|_| panic!("Time went backwards"))
9        .as_nanos() as i64
10}