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
#include <iostream>
#include <chrono>
#include <fmt/format.h>
#include <fmt/chrono.h>
int main(void)
{
// OK:
// auto t = std::chrono::system_clock::time_point::max();
// failure:
auto t = std::chrono::system_clock::time_point::min();
fmt::print("{}\n", t);
return 0;
}
Result:
terminate called after throwing an instance of 'fmt::v9::format_error'
what(): duration is too small
Code in chrono.h:2113 explicitly checks for one second above min() and fails for value= min(). For max(), works OK. Until recently, it worked fine for min(). This commit: 240b728 added the offending code. I'm not sure about the intent of this test. I discovered the issue, because one of my tests started to fail. min() value seems to be legal value, albeit used not too often.
The text was updated successfully, but these errors were encountered:
This is essentially the same issue as discussed in #3261 (comment) except that UB has been replaced with a runtime error. A PR to allow time point values close to min would be welcome. cc @ShawnZhong
https://godbolt.org/z/GbbvMb3bE
Result:
Code in
chrono.h:2113
explicitly checks for one second above min() and fails for value= min(). For max(), works OK. Until recently, it worked fine for min(). This commit: 240b728 added the offending code. I'm not sure about the intent of this test. I discovered the issue, because one of my tests started to fail. min() value seems to be legal value, albeit used not too often.The text was updated successfully, but these errors were encountered: