diff --git a/Cargo.toml b/Cargo.toml index c644a01..96c28d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] +chrono = "0.4.23" skyhook = { path = "./vendor/skyhook/skyhook" } [lib] diff --git a/src/lib.rs b/src/lib.rs index dba85c8..1d52253 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,12 @@ use std::{ ffi::{c_char, CString}, ptr::null, - time::{SystemTime, UNIX_EPOCH}, + time::UNIX_EPOCH, }; +use chrono::NaiveDateTime; + +extern crate chrono; extern crate skyhook; #[repr(C)] @@ -30,8 +33,8 @@ fn send_callback(ev: NativeEvent) { } } -fn get_time(time: SystemTime) -> usize { - time.duration_since(UNIX_EPOCH).unwrap().as_nanos() as usize +fn get_time(time: NaiveDateTime) -> usize { + time.timestamp_nanos() as usize } #[no_mangle] diff --git a/vendor/skyhook b/vendor/skyhook index 530166d..df9bf9e 160000 --- a/vendor/skyhook +++ b/vendor/skyhook @@ -1 +1 @@ -Subproject commit 530166d47103698a2613e42b47f8c89a91c2363b +Subproject commit df9bf9ea7077b7c04f014e90a66924c1cf8629cb