You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Windows 10 1809 and Windows Server 2019, FILETIME includes leap seconds after 2018-06 (configurable system-wide, enabled by default), and will no longer be a constant offset from system_clock. system_clock::now needs to be updated to account for future leap seconds, if enabled on the system.
Command-line test case
Run the following command once as administrator. Note that this inserts a fake leap second (2020-11-30T23:59:60Z). The system clock and file modification times after 2020-11-30 will be off by 1 second.
D:\Temp>cl /EHsc /W4 /WX /std:c++latest leap_second_2.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29617 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.
leap_second_2.cpp
Microsoft (R) Incremental Linker Version 14.28.29617.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:leap_second_2.exe
leap_second_2.obj
D:\Temp>.\leap_second_2.exe
Windows: 2020-12-09 06:38:33.802
STL: 18605 06:38:34.8027188
After testing, run the following command as administrator and reboot to revert the fake leap second.
Describe the bug
Since Windows 10 1809 and Windows Server 2019,
FILETIME
includes leap seconds after 2018-06 (configurable system-wide, enabled by default), and will no longer be a constant offset fromsystem_clock
.system_clock::now
needs to be updated to account for future leap seconds, if enabled on the system.Command-line test case
Run the following command once as administrator. Note that this inserts a fake leap second (2020-11-30T23:59:60Z). The system clock and file modification times after 2020-11-30 will be off by 1 second.
The following command can be used to check the status of leap seconds.
Run the test case.
After testing, run the following command as administrator and reboot to revert the fake leap second.
Expected behavior
GetSystemTime
andsystem_clock::now
should return the same time.STL version
Additional context
Related to implementation of C++20
file_clock::to_sys
xorfile_clock::to_utc
.The text was updated successfully, but these errors were encountered: