aboutsummaryrefslogtreecommitdiff
path: root/src/time.rs
diff options
context:
space:
mode:
authorpravic <[email protected]>2016-04-12 16:39:37 +0300
committerpravic <[email protected]>2016-04-12 16:39:37 +0300
commit28ff216899e95a6a9756bcbe580f28ed8ce61228 (patch)
treebbf00e3c5f3b440db5ddb3f86b6d3a893349cee0 /src/time.rs
parentgit ignore (diff)
downloadwinapi-kmd-rs-28ff216899e95a6a9756bcbe580f28ed8ce61228.tar.xz
winapi-kmd-rs-28ff216899e95a6a9756bcbe580f28ed8ce61228.zip
Windows Kernel-Mode library
Diffstat (limited to 'src/time.rs')
-rw-r--r--src/time.rs26
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;
+}