atm0s_reverse_proxy_protocol/
time.rs

1
2
3
4
5
6
7
8
9
10
11
12
use std::time::{SystemTime, UNIX_EPOCH};

pub fn now_ms() -> u64 {
    // Get the current time
    let now = SystemTime::now();

    // Calculate the duration since the UNIX epoch
    let duration = now.duration_since(UNIX_EPOCH).expect("Time went backwards");

    // Return the total milliseconds
    duration.as_millis() as u64
}