Open JMazurkiewicz opened 1 year ago
This seems like a bug in the Standard http://www.eelis.net/c++draft/time.format#4
The result of formatting a std::chrono::duration instance holding a negative value, or an hh_mm_ss object h for which h.is_negative() is true, is equivalent to the output of the corresponding positive value, with a STATICALLY-WIDEN<charT>("-") character sequence placed before the replacement of the initial conversion specifier[.](http://www.eelis.net/c++draft/time.format#4.sentence-1)
There is no corresponding positive value
for the minimum value. I'll investigate it later in more detail.
I think this needs an LWG issue.
FWIW libstdc++ prints the same thing, and also has a UBsan error.
Example:
Expected output:
Got:
Compiler explorer: https://godbolt.org/z/cvcYsTbM8 Similar issue in MSVC STL: https://github.com/microsoft/STL/issues/1902
Comparison with fmtlib: https://godbolt.org/z/YEvPYWKTb