-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Description
Describe the bug
In old Windows versions, FILETIME didn't count leap seconds. Since Windows 10 1809, Windows has become aware of leap seconds, and FILETIME counts leap seconds after 2018-06 by default (could be turned off system-wide to restore the old behavior).
Currently, system_clock::now() assumes the old behavior that FILETIME doesn't count leap seconds (#1520):
Lines 666 to 668 in 4ee3f91
| _NODISCARD static time_point now() noexcept { // get current time | |
| return time_point(duration(_Xtime_get_ticks())); | |
| } |
But file_clock::from_utc() and file_clock::to_utc() assume that FILETIME always counts leap seconds after 2017:
Lines 3324 to 3325 in 4ee3f91
| // Assumes that FILETIME counts leap seconds only after the first 27 (i.e., after 1 January 2017), even though | |
| // systems can opt out of this behavior. |
We should fix all of them to return the correct result whether or not the system is leap second aware.
STL version
4ee3f91