//! # Time utilities use std::time::{Duration, SystemTime, UNIX_EPOCH}; /// Get the current time since epoch pub fn time() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs() } /// Format UNIX time to HTTP date pub fn unix_to_system_time(time: u64) -> SystemTime { UNIX_EPOCH + Duration::from_secs(time) } /// Format UNIX time to HTTP date pub fn unix_to_http_date(time: u64) -> String { httpdate::fmt_http_date(unix_to_system_time(time)) }