datafusion_loki/utils.rs
1use std::time::{SystemTime, UNIX_EPOCH};
2
3pub fn current_timestamp_ns() -> i64 {
4 SystemTime::now()
5 .duration_since(UNIX_EPOCH)
6 .expect("Time went backwards")
7 .as_nanos() as i64
8}
9
10pub fn thirty_days_before_now_timestamp_ns() -> i64 {
11 current_timestamp_ns() - (30 * 24 * 60 * 60 * 1000 * 1000 * 1000)
12}