[Bug libstdc++/63400] [C++11]precision of std::chrono::high_resolution_clock

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Mar 8 10:21:07 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63400

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GetSystemTimePreciseAsFileTime gives UTC, so would need adjustment for leap
seconds to turn it into a sys_time. That's doable though.

Alternatively, we could use it to implement a high performance
chrono::utc_clock, and then define system_clock::now() in terms of that.

The standard specifies utc_clock::now() as:

"Returns: from_sys(system_clock::now()), or a more accurate value of utc_time."


Also, if Windows FILETIME is measured in UTC then chrono::file_clock should use
that too. So we might want to use a custom implementation of chrono::file_clock
for Windows.


More information about the Gcc-bugs mailing list