gcc bug: complaint on %c for strftime
Pavel Roskin
proski@gnu.org
Tue Nov 26 11:12:00 GMT 2002
Hello!
On Tue, 26 Nov 2002 Andries.Brouwer@cwi.nl wrote:
> Various versions of gcc such as gcc 3.2 complain
> about strftime(,,"%c",) with the reaction
>
> warning: `%c' yields only last 2 digits of year in some locales
>
> This is a bug.
This is the bug number 3190:
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?database=gcc&pr=3190
You probably clicked on "send email to interested parties" in gnatsweb,
but your message didn't appear there because you removed the bug number
from the subject. Just a guess, I'm not an expert in gnatsweb.
That's what I do in GNU Midnight Commander.
char s[1024];
/* fool gcc to prevent a Y2K warning */
char time_format[] = "_c";
time_format[0] = '%';
time (&t);
strftime (s, sizeof (s), time_format, localtime (&t));
This code implements a command "insert date/time" in the internal editor.
And if I use "%c", the error is the same:
warning: `%c' yields only last 2 digits of year in some locales
> %c is described as: the preferred date and time representation for the
> current locale. How can you give an error message for that? What is the
> programmer to do? Choose a non-preferred representation?
I agree. I'm printing the date for the user in the format preferred by
the user. That's the expected behavior. If the user wants only two last
2 digits of year, it's not my problem - it's a problem of that locale.
--
Regards,
Pavel Roskin
More information about the Gcc
mailing list