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

Bug#48184: localtime and friends does not watch for timezone changes



Package: libc6
Version: 2.1.2-5

applications using localtime to acquire locale or timezone data are not
informed of a timezone switch.  So, if you start and application that uses
strftime() for instance, then run tzconfig to change the timezone, the proper
time is not shown, instead the previous value is.

one:~/test_code$ ./time 
Sun Oct 24  7:56 AM EDT EST,EDT
Sun Oct 24  7:56 AM EDT EST,EDT
< run tzconfig on another term >
Sun Oct 24  7:56 AM EDT EST,EDT
Sun Oct 24  7:56 AM EDT EST,EDT
Sun Oct 24  7:57 AM EDT EST,EDT
Sun Oct 24  7:57 AM EDT EST,EDT
Sun Oct 24  7:57 AM EDT EST,EDT
Sun Oct 24  7:57 AM EDT EST,EDT
Sun Oct 24  7:57 AM EDT EST,EDT
Sun Oct 24  7:57 AM EDT EST,EDT
Sun Oct 24  7:57 AM EDT EST,EDT

note how time never changes

while (1) {
        tmp = time(NULL);
        tt = localtime(&tmp);
        strftime(t, 1024, "%a %b %e %l:%M %p %Z", tt);
        printf("%s %s,%s\n", t, tzname[0], tzname[1]);
        memset(t, '\0', 1024);
        sleep(1);
}

simple code I used to prove this exists.

If I can help, please contact me.


Reply to: