[Bug 4976] Daylight saving time calculation fails when M-specifier is larger than number of weeks in the month

bugzilla at busybox.net bugzilla at busybox.net
Fri Mar 30 15:58:05 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=4976

Bernhard Reutner-Fischer <aldot at uclibc.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Bernhard Reutner-Fischer <aldot at uclibc.org> 2012-03-30 15:58:05 UTC ---
(In reply to comment #1)
> I observe the same issue with uclibc 0.9.30.1.
> It seems that due to some bug it expects that in March 2012 there will be at
> least an extra sunday (32th?)
> 
> # TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3 date -d '2012-03-30 12:00'
> Fri Mar 30 12:00:00 CET 2012
> # TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3 date -d '2012-03-31 12:00'
> Sat Mar 31 12:00:00 CET 2012
> # TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3 date -d '2012-03-32 12:00'
> Sun Apr  1 12:00:00 CEST 2012
> # TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3 date -d '2012-04-01 12:00'
> Sun Apr  1 12:00:00 CEST 2012
> 
> CEST begins on last sunday of March. There were 4 sundays in March, the last
> was on the 25th.
> 
> I didn't find any timezone-related fixes in the change logs since 0.9.30.1.

This was fixed in 0.9.33:

$ TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3 ./date_uClibc '2012-03-30 12:00'
'2012-03-31 12:00' '2012-03-32 12:00' '2012-04-01 12:00' 
Using TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3
'2012-03-30 12:00' -> '2012-03-30 12:00'
'2012-03-31 12:00' -> '2012-03-31 12:00'
'2012-03-32 12:00' -> '1900-01-?? 00:00' got INVALID date
'2012-04-01 12:00' -> '2012-04-01 12:00'
$ TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3 ./date_glibc '2012-03-30 12:00' '2012-03-31
12:00' '2012-03-32 12:00' '2012-04-01 12:00' 
Using TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3
'2012-03-30 12:00' -> '2012-03-30 12:00'
'2012-03-31 12:00' -> '2012-03-31 12:00'
'2012-03-32 12:00' -> '2012-03-00 00:00' got INVALID date
'2012-04-01 12:00' -> '2012-04-01 12:00'
$ cat date.c
/*
TZ=CET-1CEST-2,M3.5.0/2,M10.5.0/3 ./date '2012-03-31 12:00' '2012-03-32 12:00'
*/
#define _XOPEN_SOURCE
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char **argv) {
    struct tm tm;
    char buf[128];
    const char * date_fmt = "%Y-%m-%d %H:%M";
    char *chp;
    int ret = 0;

    if ((chp = getenv("TZ")) == NULL)
        return 2;
    printf("Using TZ=%s\n", chp);
    while (++argv && *argv) {
        memset(&tm, 0, sizeof(struct tm));
        memset(&buf, 0, sizeof buf);

        chp = strptime(*argv, date_fmt, &tm);
        ret |= chp == NULL; /* invalid date */
        strftime(buf, sizeof buf, date_fmt, &tm);
        printf("'%s' -> '%s'%s\n", *argv, buf,
                chp == NULL ? " got INVALID date" : "");
    }
    return ret;
}

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list