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):
|
_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:
|
// 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
Describe the bug
In old Windows versions,
FILETIMEdidn't count leap seconds. Since Windows 10 1809, Windows has become aware of leap seconds, andFILETIMEcounts 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 thatFILETIMEdoesn't count leap seconds (#1520):STL/stl/inc/chrono
Lines 666 to 668 in 4ee3f91
But
file_clock::from_utc()andfile_clock::to_utc()assume thatFILETIMEalways counts leap seconds after 2017:STL/stl/inc/chrono
Lines 3324 to 3325 in 4ee3f91
We should fix all of them to return the correct result whether or not the system is leap second aware.
STL version
4ee3f91