Skip to content

Commit

Permalink
Rollup merge of #69858 - da-x:windows-precise-time, r=Dylan-DPC
Browse files Browse the repository at this point in the history
std: on Windows, use GetSystemTimePreciseAsFileTime if it is available

This implements #67266.
  • Loading branch information
Dylan-DPC authored Mar 16, 2020
2 parents e5de0b1 + 0605abe commit 957241f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/libstd/sys/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,10 @@ compat_fn! {
_dwBufferSize: DWORD) -> BOOL {
SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0
}
pub fn GetSystemTimePreciseAsFileTime(lpSystemTimeAsFileTime: LPFILETIME)
-> () {
GetSystemTimeAsFileTime(lpSystemTimeAsFileTime)
}
pub fn SleepConditionVariableSRW(ConditionVariable: PCONDITION_VARIABLE,
SRWLock: PSRWLOCK,
dwMilliseconds: DWORD,
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/windows/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl SystemTime {
pub fn now() -> SystemTime {
unsafe {
let mut t: SystemTime = mem::zeroed();
c::GetSystemTimeAsFileTime(&mut t.t);
c::GetSystemTimePreciseAsFileTime(&mut t.t);
t
}
}
Expand Down

0 comments on commit 957241f

Please sign in to comment.