low precision of nanoTimestamp on windows #22460
Labels
bug
Observed behavior contradicts documented or intended behavior
contributor friendly
This issue is limited in scope and/or knowledge of Zig internals.
os-windows
standard library
This issue involves writing Zig code for the standard library.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
nanoTimestamp
on windows currently uses GetSystemTimeAsFileTime, however there is a more precise windows api GetSystemTimePreciseAsFileTime. I tried searching for a discussion on whyGetSystemTimeAsFileTime
is used overGetSystemTimePreciseAsFileTime
, but couldn't find anything on the topic. The MSDN documentation states thatGetSystemTimePreciseAsFileTime
has been available since Windows 8, and based on some issue searching it seems that Windows 7 isn't supported (see this).So based on that I'd recommend that
nanoTimestamp
useGetSystemTimePreciseAsFileTime
instead. I've written an example program (sorry in 0.13.0 not master) to show thatGetSystemTimePreciseAsFileTime
does give a better precision fornanoTimestamp
on windows.output:
Expected Behavior
nanoTimestamp
on Windows has better precision.The text was updated successfully, but these errors were encountered: