aboutsummaryrefslogtreecommitdiff
path: root/src/time.rs
blob: b4d0e992b8de73f54c200f0a0e8bd75b8e732a39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}