Source-Changes archive

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

CVS commit: src/lib/libc/time



Module Name:    src
Committed By:   drochner
Date:           Sun Jan 18 10:57:15 UTC 2009

Modified Files:
        src/lib/libc/time: localtime.c

Log Message:
Make mktime(3) work with 64-bit time_t.
The problem is that the tm_year field of "struct tm" is just an "int"
(per POSIX), and thus time_t values >  2^31*60*60*24*365 cannot
be converted. This made mktime(3) fail even if no such large time values
were passed in by user code because the algorithm does a binary search
over the time_t range which fails if a probe value cannot be converted.
To fix this, limit the time_t range to be scanned to 55 bits (which
is a bit on the safe side, but still good until y570855533).
This is more a stopgap fix, the overflow should be checked for
at other places as well (eg localtime(3)), and there are some more
limitations in timezone parsing code.


To generate a diff of this commit:
cvs rdiff -r1.42 -r1.43 src/lib/libc/time/localtime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Home | Main Index | Thread Index | Old Index