This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc bug: complaint on %c for strftime
- From: Pavel Roskin <proski at gnu dot org>
- To: Andries dot Brouwer at cwi dot nl
- Cc: jsm28 at cam dot ac dot uk, gcc at gcc dot gnu dot org
- Date: Tue, 26 Nov 2002 09:16:00 -0500 (EST)
- Subject: Re: gcc bug: complaint on %c for strftime
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