fix: add systemtime_as_secs
This commit is contained in:
parent
3ae6d79296
commit
2fa22a2752
1 changed files with 9 additions and 0 deletions
9
src/systemtime_as_secs.rs
Normal file
9
src/systemtime_as_secs.rs
Normal 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()
|
||||||
|
}
|
Loading…
Reference in a new issue