Description
SystemTime::now
is implemented in windows using the GetSystemTimeAsFileTime
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 in src/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 fields dwLowDateTime
and dwHighDateTime
. These fields correspond to the first and last 32 bits of the 64 bits number counting the 100-nanosecond intervals (so its basically an u64
represented as two u32
).
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:
use std::time::SystemTime;
fn main() {
let _now = SystemTime::now();
}
Which can be found in miri/tests/run-pass/time.rs
.