Created attachment 38713 [details] C++ reproducer In contrast to strptime(), std::get_time() requires leading zeroes for %H and friends, so times with " 9" (%k formatting) instead of "09" cannot be parsed. The C++ standard requires get_time() to work like strptime(), as far as I can tell, and cppreference tells us that leading 0s are permitted, but optional. This means we cannot parse a date like: "Thu, 16 Jun 2016 9:35:47 UTC" which in turn breaks date parsing for recent APT versions when we switched from strptime to std::get_time().
To be clear, while the attachment uses the (I assume still) non-standard C.UTF-8, the same also happens with the C locale, and the "" locale in an en_IE.UTF-8 environment.
I also just ran into this. Took me a while to convince myself that I was actually looking at a compiler (well library) bug before searching. clang does not have this issue. It also affects %m and %d. Haven't tried any others.
People keep hitting this bug: https://stackoverflow.com/questions/44901711/convert-ansi-cs-asctime-format-using-stdget-time
The leading zeros were required in C++98, but are optional since C++1. This is Bug 45896. *** This bug has been marked as a duplicate of bug 45896 ***