Implement GetSystemTimeAsFileTime
shim for Windows
#997
Labels
A-shims
Area: This affects the external function shims
A-windows
Area: affects only Windows targets
C-enhancement
Category: a PR with an enhancement or an issue tracking an accepted enhancement
SystemTime::now
is implemented in windows using theGetSystemTimeAsFileTime
foreign function, which currently doesn't have a shim in miri.Some instructions:
Implementing the shim for
GetSystemTimeAsFileTime
its pretty similar to the linux (clock_gettime
) and macOS (gettimeofday
) shims (those can already be found insrc/shims/time.rs
). Its functionality is described in detail here.The main difference is that this shim only has one argument: a pointer to a
FILETIME
structure, which has two integer fieldsdwLowDateTime
anddwHighDateTime
. These fields correspond to the first and last 32 bits of the 64 bits number counting the 100-nanosecond intervals (so its basically anu64
represented as twou32
).It is also important to take into account that windows counts time since January 1, 1601 instead of January 1, 1970.
The testcase for this issue is:
Which can be found in
miri/tests/run-pass/time.rs
.The text was updated successfully, but these errors were encountered: