Rollup merge of #121633 - ChrisDenton:precise, r=Nilstrieb
Win10: Use `GetSystemTimePreciseAsFileTime` directly On Windows 10 we can use `GetSystemTimePreciseAsFileTime` directly instead of lazy loading it (with a fallback).
This commit is contained in:
commit
1a989e0757
@ -344,6 +344,7 @@ pub fn GetThreadDescription(hthread: HANDLE, lpthreaddescription: *mut PWSTR) ->
|
|||||||
|
|
||||||
// >= Win8 / Server 2012
|
// >= Win8 / Server 2012
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
|
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
|
||||||
|
#[cfg(target_vendor = "win7")]
|
||||||
pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () {
|
pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () {
|
||||||
GetSystemTimeAsFileTime(lpsystemtimeasfiletime)
|
GetSystemTimeAsFileTime(lpsystemtimeasfiletime)
|
||||||
}
|
}
|
||||||
|
@ -2476,6 +2476,7 @@ Windows.Win32.System.Pipes.PIPE_WAIT
|
|||||||
Windows.Win32.System.SystemInformation.GetSystemDirectoryW
|
Windows.Win32.System.SystemInformation.GetSystemDirectoryW
|
||||||
Windows.Win32.System.SystemInformation.GetSystemInfo
|
Windows.Win32.System.SystemInformation.GetSystemInfo
|
||||||
Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime
|
Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime
|
||||||
|
Windows.Win32.System.SystemInformation.GetSystemTimePreciseAsFileTime
|
||||||
Windows.Win32.System.SystemInformation.GetWindowsDirectoryW
|
Windows.Win32.System.SystemInformation.GetWindowsDirectoryW
|
||||||
Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE
|
Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE
|
||||||
Windows.Win32.System.SystemInformation.SYSTEM_INFO
|
Windows.Win32.System.SystemInformation.SYSTEM_INFO
|
||||||
|
@ -345,6 +345,10 @@ pub fn GetOverlappedResult(
|
|||||||
pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> ();
|
pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> ();
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
|
extern "system" {
|
||||||
|
pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> ();
|
||||||
|
}
|
||||||
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn GetTempPathW(nbufferlength: u32, lpbuffer: PWSTR) -> u32;
|
pub fn GetTempPathW(nbufferlength: u32, lpbuffer: PWSTR) -> u32;
|
||||||
}
|
}
|
||||||
|
@ -110,12 +110,13 @@ fn gettimeofday(
|
|||||||
#[allow(non_snake_case, clippy::arithmetic_side_effects)]
|
#[allow(non_snake_case, clippy::arithmetic_side_effects)]
|
||||||
fn GetSystemTimeAsFileTime(
|
fn GetSystemTimeAsFileTime(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
shim_name: &str,
|
||||||
LPFILETIME_op: &OpTy<'tcx, Provenance>,
|
LPFILETIME_op: &OpTy<'tcx, Provenance>,
|
||||||
) -> InterpResult<'tcx> {
|
) -> InterpResult<'tcx> {
|
||||||
let this = self.eval_context_mut();
|
let this = self.eval_context_mut();
|
||||||
|
|
||||||
this.assert_target_os("windows", "GetSystemTimeAsFileTime");
|
this.assert_target_os("windows", shim_name);
|
||||||
this.check_no_isolation("`GetSystemTimeAsFileTime`")?;
|
this.check_no_isolation(shim_name)?;
|
||||||
|
|
||||||
let filetime = this.deref_pointer_as(LPFILETIME_op, this.windows_ty_layout("FILETIME"))?;
|
let filetime = this.deref_pointer_as(LPFILETIME_op, this.windows_ty_layout("FILETIME"))?;
|
||||||
|
|
||||||
|
@ -257,11 +257,11 @@ fn emulate_foreign_item_inner(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Time related shims
|
// Time related shims
|
||||||
"GetSystemTimeAsFileTime" => {
|
"GetSystemTimeAsFileTime" | "GetSystemTimePreciseAsFileTime" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
let [LPFILETIME] =
|
let [LPFILETIME] =
|
||||||
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
|
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
|
||||||
this.GetSystemTimeAsFileTime(LPFILETIME)?;
|
this.GetSystemTimeAsFileTime(link_name.as_str(), LPFILETIME)?;
|
||||||
}
|
}
|
||||||
"QueryPerformanceCounter" => {
|
"QueryPerformanceCounter" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
Loading…
Reference in New Issue
Block a user