2024-07-01 15:56:10 +00:00
|
|
|
use std::time::{SystemTime, UNIX_EPOCH};
|
|
|
|
|
|
|
|
/// Get the current time since epoch
|
2024-07-02 20:55:51 +00:00
|
|
|
pub fn time_secs() -> u64 {
|
|
|
|
SystemTime::now()
|
|
|
|
.duration_since(UNIX_EPOCH)
|
|
|
|
.unwrap()
|
|
|
|
.as_secs()
|
|
|
|
}
|
2024-07-01 15:56:10 +00:00
|
|
|
|
2024-07-02 20:55:51 +00:00
|
|
|
/// Get the current time since epoch
|
2024-07-01 15:56:10 +00:00
|
|
|
pub fn time_millis() -> u128 {
|
|
|
|
SystemTime::now()
|
|
|
|
.duration_since(UNIX_EPOCH)
|
|
|
|
.unwrap()
|
|
|
|
.as_millis()
|
|
|
|
}
|