If I use to_stream(os, "%X", ymd), I get the 00:00:00 in os in addition to a failbit while to_stream(os, "%c", ymd) just sets failbit without outputing anything. I suspect that I get a failbit because there is no time information in ymd and %X means "The locale's time representation"; this seems reasonable to me. However in case of an error, shouldn't we avoid any output at all?
This programs shows the different behaviour of the different formats:
date_to_stream.cpp.gz
Here is the output I get both with g++ 8.2.0 and with clang++ 6.0.1 on linux x86_64:
If I use
to_stream(os, "%X", ymd)
, I get the00:00:00
inos
in addition to a failbit whileto_stream(os, "%c", ymd)
just sets failbit without outputing anything. I suspect that I get a failbit because there is no time information inymd
and%X
means "The locale's time representation"; this seems reasonable to me. However in case of an error, shouldn't we avoid any output at all?This programs shows the different behaviour of the different formats: date_to_stream.cpp.gz Here is the output I get both with g++ 8.2.0 and with clang++ 6.0.1 on linux x86_64: