1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-28 08:00:04 +08:00

feat: add print_status_context

This commit is contained in:
2020-09-20 16:47:34 +08:00
parent dd2bec2669
commit 289fe68e61
3 changed files with 55 additions and 22 deletions

View File

@@ -1,9 +1,9 @@
use std::time::SystemTime;
pub fn get_current_secs() -> u64 {
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs()
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0 /* SHOULD NOT HAPPEN */ )
}
pub fn get_current_millis() -> u128 {
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis()
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).map(|d| d.as_millis()).unwrap_or(0 /* SHOULD NOT HAPPEN */ )
}