VirtWeb/virtweb_backend/src/utils/time_utils.rs

16 lines
296 B
Rust
Raw Normal View History

use std::time::{SystemTime, UNIX_EPOCH};
/// Get the current time since epoch
///
/// ```
/// use virtweb_backend::utils::time_utils::time;
///
/// let time = time();
/// ```
pub fn time() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}