-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<chrono>: clock_cast throws an exception under windows7 sp1 #2446
Comments
See:
2) Lines 3428 to 3434 in 9265c51
BOOM. I'm not a chrono expert. Perhaps something in this sequence of calls is wrong. But in my opinioin it's unfortunate but i's correct. Now is the holiday period at Microsoft, until January 3 (or 10 for some people). So the response from |
Thanks for your answer. |
Yes, the clock conversions that need leap second info take it from the |
See also #1911 |
For now we built a wrapper function to benefit from high-precision file write times from std::filesystem, while still supporting older versions of Windows: // Define these somewhere
using file_duration = std::chrono::duration<long long, std::filesystem::file_time_type::period>;
using file_time_point = std::chrono::time_point<std::chrono::system_clock, file_duration>;
// Write a wrapper function that avoids clock_casts
// Note: leap seconds are NOT considered, as they require a time zone database!
std::error_code ec;
auto file_time = std::filesystem::last_write_time(path, ec);
auto last_write_time = std::chrono::time_point_cast<file_duration>(file_time - std::filesystem::file_time_type::clock::now() + std::chrono::system_clock::now()); |
build fix for libcpp < 14000
code:
try { auto timestamp = std::chrono::clock_cast<std::chrono::system_clock>(std::filesystem::last_write_time(entity)); } catch (const std::exception& e) { // Caught exception }
debug:
__std_tzdb_get_time_zones
failed because the error code is_Win_error
The text was updated successfully, but these errors were encountered: