diff options
Diffstat (limited to 'src/time.rs')
| -rw-r--r-- | src/time.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/time.rs b/src/time.rs new file mode 100644 index 0000000..b4d0e99 --- /dev/null +++ b/src/time.rs @@ -0,0 +1,26 @@ +//! NT Time routines. + +/// System time is a count of 100-nanosecond intervals since January 1, 1601. +pub type SYSTEMTIME = i64; + +extern "system" +{ + fn KeQuerySystemTime(CurrentTime: *mut SYSTEMTIME); + fn KeQueryTickCount(TickCount: *mut i64); + /// Converts a GMT system time value to the local system time for the current time zone. + pub fn ExSystemTimeToLocalTime(SystemTime: *const SYSTEMTIME, LocalTime: *mut SYSTEMTIME); +} + +/// Obtains the current system time. +pub fn QuerySystemTime() -> SYSTEMTIME { + let mut t = 0i64; + unsafe { KeQuerySystemTime(&mut t) }; + return t; +} + +/// A count of the interval timer interrupts that have occurred since the system was booted. +pub fn QueryTickCount() -> i64 { + let mut t = 0i64; + unsafe { KeQueryTickCount(&mut t) }; + return t; +} |