aboutsummaryrefslogtreecommitdiff
path: root/src/time.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-18 12:24:37 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-18 12:26:50 +0200
commit7a3ce9f81963cc374271272bfe4e0e204e9b7012 (patch)
tree369a1c390d5aeb5f3ce2515b677affca366cc328 /src/time.rs
downloadaerogramme-7a3ce9f81963cc374271272bfe4e0e204e9b7012.tar.gz
aerogramme-7a3ce9f81963cc374271272bfe4e0e204e9b7012.zip
Skeleton for some stuff
Diffstat (limited to 'src/time.rs')
-rw-r--r--src/time.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/time.rs b/src/time.rs
new file mode 100644
index 0000000..d34ee22
--- /dev/null
+++ b/src/time.rs
@@ -0,0 +1,9 @@
+use std::time::{SystemTime, UNIX_EPOCH};
+
+/// Returns milliseconds since UNIX Epoch
+pub fn now_msec() -> u64 {
+ SystemTime::now()
+ .duration_since(UNIX_EPOCH)
+ .expect("Fix your clock :o")
+ .as_millis() as u64
+}