Skip to content

Commit 0f048a8

Browse files
authored
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).
2 parents 62167af + a38b48b commit 0f048a8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/shims/time.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
110110
#[allow(non_snake_case, clippy::arithmetic_side_effects)]
111111
fn GetSystemTimeAsFileTime(
112112
&mut self,
113+
shim_name: &str,
113114
LPFILETIME_op: &OpTy<'tcx, Provenance>,
114115
) -> InterpResult<'tcx> {
115116
let this = self.eval_context_mut();
116117

117-
this.assert_target_os("windows", "GetSystemTimeAsFileTime");
118-
this.check_no_isolation("`GetSystemTimeAsFileTime`")?;
118+
this.assert_target_os("windows", shim_name);
119+
this.check_no_isolation(shim_name)?;
119120

120121
let filetime = this.deref_pointer_as(LPFILETIME_op, this.windows_ty_layout("FILETIME"))?;
121122

src/shims/windows/foreign_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
257257
}
258258

259259
// Time related shims
260-
"GetSystemTimeAsFileTime" => {
260+
"GetSystemTimeAsFileTime" | "GetSystemTimePreciseAsFileTime" => {
261261
#[allow(non_snake_case)]
262262
let [LPFILETIME] =
263263
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
264-
this.GetSystemTimeAsFileTime(LPFILETIME)?;
264+
this.GetSystemTimeAsFileTime(link_name.as_str(), LPFILETIME)?;
265265
}
266266
"QueryPerformanceCounter" => {
267267
#[allow(non_snake_case)]

0 commit comments

Comments
 (0)