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

add time, iff!

This commit is contained in:
2019-12-28 09:45:56 +08:00
parent 7d5bb125ba
commit c4c6273c38
3 changed files with 19 additions and 1 deletions

9
src/util_time.rs Normal file
View File

@@ -0,0 +1,9 @@
use std::time::SystemTime;
pub fn get_current_secs() -> u64 {
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs()
}
pub fn get_current_millis() -> u128 {
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis()
}