Description of Problem: mktime has changed and is returning different values between the mentioned versions of glibc. Affects i386 and ia64 and perhaps more. Demonstration program and output when run on boris (glibc 2.2.5-30, but 2.2.5-32 inside buildroot) #include <time.h> #include <stdio.h> int main() { struct tm t; time_t result; t.tm_sec = 59; t.tm_min = 59; t.tm_hour = 23; t.tm_mday = 31; t.tm_mon = 11; t.tm_year = 69; result = mktime(&t); printf("time: %ld, %s", (long)result, ctime(&result)); return 1; } [cturner@boris cturner]$ gcc -Wall test.c -o test [cturner@boris cturner]$ ./test time: 17999, Wed Dec 31 23:59:59 1969 [cturner@boris cturner]$ cp tes [cturner@boris cturner]$ sudo /usr/sbin/chroot /mnt/build/beehive/dist-7.3-build/ [cturner@boris cturner]$ cp test.c /mnt/build/beehive/dist-7.3-build/tmp [cturner@boris cturner]$ sudo su - [root@boris root]# chroot /mnt/build/beehive/dist-7.3-build [root@boris /]# cd /tmp [root@boris tmp]# gcc -Wall test.c -o test [root@boris tmp]# ./test time: -1, Wed Dec 31 18:59:59 1969
marked 63361 as depending on this
Yes, this has changed. See http://bugs.gnu.org/cgi-bin/gnatsweb.pl?debug=&database=default&cmd=view+audit-trail&cmd=view&pr=2738 A value that approximates the number of seconds that have elapsed since the Epoch. A Coordinated Universal Time name (specified in terms of seconds (tm_sec), minutes (tm_min), hours (tm_hour), days since January 1 of the year (tm_yday), and calendar year minus 1900 (tm_year)) is related to a time represented as seconds since the Epoch, according to the expression below. If the year is <1970 or the value is negative, the relationship is undefined. If the year is 1970 and the value is non-negative, the value is related to a Coordinated Universal Time name according to the C-language expression, where tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all And mktime is defined as: The mktime( ) function shall return the specified time since the Epoch encoded as a value of type time_t. If the time since the Epoch cannot be represented, the function shall return the value (time_t)-1. tm_year=69 means a year < 1970 and therefore undefined and cannot be represented. Was this some standard conformance suite or what have you used to find out about this?
The time passed is interpreted as in the current timezone. Hence, the time since the epoch *can* be represented.
As to what prompted this, this is what causes perl-Date-Calc to fail building, as its test suite fails.
http://sources.redhat.com/ml/libc-hacker/2002-04/msg00053.html was added into glibc-2.2.5-33. Can you please check it out?
Looks good, output of test.c on my workstation with glibc-2.2.5-33 is: [cturner@minbar cturner]$ ./test time: 17999, Wed Dec 31 23:59:59 1969 perl-Date-Calc also passes its tests now