fix: add systemtime_as_secs

This commit is contained in:
slonkazoid 2024-04-30 17:34:46 +03:00
parent 3ae6d79296
commit 2fa22a2752
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM

View file

@ -0,0 +1,9 @@
use std::time::SystemTime;
pub fn as_secs(t: &SystemTime) -> u64 {
match t.duration_since(SystemTime::UNIX_EPOCH) {
Ok(duration) => duration,
Err(err) => err.duration(),
}
.as_secs()
}