bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: bug report with strftime on win2000


From: Aharon Robbins
Subject: RE: bug report with strftime on win2000
Date: Wed, 1 Jan 2003 15:02:02 +0200

Hi, and Happy New Year.

After doing some more research, I don't believe it's a bug.
The calculation is based on the ISO 8601 standard, in which the first
week of a year is the one containing the first Thursday of January.
In the case of this year, Sunday - Tuesday 12/29 - 12/31 of the week
are in week 1 of 2003, even though they're still in calendar year 2002.
Thus %g, which is the two-digit ISO year, is 03 for the last three days
of December 2002.

Arthur David Olsen's date and timezone code, in use world wide for over
15 years, produces the same result as my strftime (and more importantly,
as glibc's) for this format.  If you need the calendar year, you should
use a calendar-year format, like %y.

As mentioned in an earlier email, I did not write the glibc strftime.

I hope this helps.

Arnold

> From: "Marko Lesar" <address@hidden>
> To: "Aharon Robbins" <address@hidden>
> Subject: RE: bug report with strftime on win2000
> Date: Tue, 31 Dec 2002 14:55:12 +0100
>
> I just referenced the results you gave in Linux, and maybe had some
> untasty humour, since I don't prefer neither of the OSs and think that
> Linux is a good solution, but we just don't use it here.
> 
> So it looks like the bug has to be forwarded to the gnu libc authors,
> since the bug will reapear on 29.12.2003-31.12.2003. I think that this
> should be you, since you're the author of the code.
> 
> The bug caused an error in a finance reporting tool here, and we had to
> made some provisory programming to fix it, but now we are prepared for
> those dates next year.
>
> best regards
> Marko Lesar
>
> -----Original Message-----
> From: Aharon Robbins [mailto:address@hidden
> Sent: Tuesday, December 31, 2002 2:49 PM
> To: address@hidden; address@hidden
> Subject: RE: bug report with strftime on win2000
>
>
> I beg your pardon?  The results I showed are what I just got, on my
> GNU/Linux system.  I have LC_ALL="C" in my environment; I begin to suspect
> locale-related issues.
>
> Let's bypass gawk.  Redhat 8.0 GNU/Linux; here's some C code:
>
>       #include <stdio.h>
>       #include <time.h>
>       
>       int main(void)
>       {
>               char buf[100];
>               time_t now;
>               struct tm *t;
>       
>               (void) time(& now);
>               t = localtime(& now);
>       
>               strftime(buf, sizeof buf, "%g%m%d", t);
>       
>               printf("%s\n", buf);
>       }
>
> Upon compiling and running it:
>
>       $ cc foo.c
>       $ a.out
>       031231
>
> If there's a bug, I don't know what it is, but it's not in gawk, it's
> in the underlying C strftime function.
>
> I hope this helps.
>
> Arnold
>
> > From: "Marko Lesar" <address@hidden>
> > To: "Aharon Robbins" <address@hidden>
> > Subject: RE: bug report with strftime on win2000
> > Date: Tue, 31 Dec 2002 14:30:48 +0100
> >
> > Greetings too. And it's not 031231, even under Linux.
> >
> > Marko
> >
> > -----Original Message-----
> > From: Aharon Robbins [mailto:address@hidden
> > Sent: Tuesday, December 31, 2002 2:26 PM
> > To: address@hidden; address@hidden
> > Subject: Re: bug report with strftime on win2000
> >
> > Greetings.  Re this:
> >
> > > From: "Marko Lesar" <address@hidden>
> > > To: <address@hidden>, <address@hidden>
> > > Cc: <address@hidden>
> > > Subject: bug report with strftime on win2000
> > > Date: Tue, 31 Dec 2002 09:07:43 +0100
> > >
> > > Bugreport:
> > >
> > > Versions:
> > >
> > > gawk -W version
> > > GNU Awk 3.0.4
> > > Copyright (C) 1989, 1991-1999 Free Software Foundation.
> >
> > This version is severely out of date.  The current version is
> > 3.1.1.  Under Linux, I get:
> >
> > $ date
> > Tue Dec 31 15:24:11 IST 2002
> > $ gawk 'BEGIN { print strftime("%g%m%d",systime()) }'
> > 031231
> >
> > The C strftime in this version of gawk is orignally from GNU libc,
> > and I believe the code is correct.
> >
> > Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]