Created attachment 12690 [details] C program demonstrating the issue glibc 2.26 and 2.31 (x86_64) strftime's format string %A does not recognize %-10A while %10A and %-A work as expected see attached sample program that demonstrates that there is no difference in output between %10A and %-10A Leaving out the width specifier (%A and %-A) produces the correct: Saturday Jul 11, 8:59:44 pm Saturday Jul 11, 8:59:44 pm but including the width specifier produces the same string for %10A and %-10A Saturday Jul 11, 8:57:42 pm Saturday Jul 11, 8:57:42 pm
The '-' flag is only valid for numeric formats.
That makes it different than the behavior of sprintf or printf. Shouldn't it be desirable to try to conform to the same rules when possible? Note that the "-" *is* recognized for %A even though you are correct the man page claims it is only for numeric formats. It just does not recognize it when there is a width value involved. Seems like this is also contra the man page - either way this should be reconsidered and implemented as its worth doing imho. Here's my reasoning: 1: It makes column alignment much easier 2: closer conformance with sprint/snprintf/printf format specifiers 3: The fix should be fairly easy (low resource requirements) considering the basic code is available in the code for printf/sprintf and already implemented for strftime with numerics
'-' is already used by another GNU extension, to suppress padding.
strftime and printf formats are unrelated.