Skip to content

Commit 957241f

Browse files
authored
Rollup merge of #69858 - da-x:windows-precise-time, r=Dylan-DPC
std: on Windows, use GetSystemTimePreciseAsFileTime if it is available This implements #67266.
2 parents e5de0b1 + 0605abe commit 957241f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/libstd/sys/windows/c.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,10 @@ compat_fn! {
10451045
_dwBufferSize: DWORD) -> BOOL {
10461046
SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0
10471047
}
1048+
pub fn GetSystemTimePreciseAsFileTime(lpSystemTimeAsFileTime: LPFILETIME)
1049+
-> () {
1050+
GetSystemTimeAsFileTime(lpSystemTimeAsFileTime)
1051+
}
10481052
pub fn SleepConditionVariableSRW(ConditionVariable: PCONDITION_VARIABLE,
10491053
SRWLock: PSRWLOCK,
10501054
dwMilliseconds: DWORD,

src/libstd/sys/windows/time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl SystemTime {
7474
pub fn now() -> SystemTime {
7575
unsafe {
7676
let mut t: SystemTime = mem::zeroed();
77-
c::GetSystemTimeAsFileTime(&mut t.t);
77+
c::GetSystemTimePreciseAsFileTime(&mut t.t);
7878
t
7979
}
8080
}

0 commit comments

Comments
 (0)