Re: [tz] timegm() function and state
I tried to reproduce that configuration under Ubuntu but still did not see the problem. Here's how I built it: make CFLAGS='-DNOID -DUSG_COMPAT -DSTD_INSPIRED -DPCTS -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DTZDEFRULESTRING=\",M3.2.0/2,M11.1.0/2\"' TOPDIR=/tmp/top install gcc -I. test.c /tmp/top/lib/libtz.a and here's my test program: #include <string.h> #include <errno.h> #include <stdio.h> #include <time.h> int main(int argc, char *argv[]) { struct tm localt; localt.tm_sec = 0; localt.tm_min = 0; localt.tm_hour = 0; localt.tm_mday = 1; localt.tm_year = 113; localt.tm_mon = 0; localt.tm_wday = 0; localt.tm_yday = 0; localt.tm_isdst = 0; localt.tm_gmtoff = 0; localt.tm_zone = 0; mktime(&localt); printf("asctime: %s", asctime(&localt)); printf("timegm(&localt) = %ld (errno %s)\n", timegm(&localt), strerror(errno)); printf("timegm(&localt) = %ld (errno %s)\n", timegm(&localt), strerror(errno)); printf("timegm(&localt) = %ld (errno %s)\n", timegm(&localt), strerror(errno)); return 0; } and its output: asctime: Tue Jan 1 00:00:00 2013 timegm(&localt) = 1356998400 (errno Success) timegm(&localt) = 1356998400 (errno Success) timegm(&localt) = 1356998400 (errno Success)
participants (1)
-
Paul Eggert