glibc/time
Albert ARIBAUD (3ADEV) ac253355ba Y2038: make __difftime compatible with 64-bit time
Provide a 64-bit-time version of __difftime (but do not assume
__time64_t is a signed int so that Gnulib can reuse the code)
and make the 32-bit version a wrapper of it.

Current difftime expects two time_t arguments and returns a
double. To preserve source-code compatibility, its 64-bit-time
equivalent expects two __time64_t arguments but still returns
a double.

This patch was tested by running 'make check' on branch
master then applying this patch and its two predecessors and
running 'make check' again, and checking that both 'make check'
yield identical results. This was done on x86_64-linux-gnu and
i686-linux-gnu.

This patch was also functionally tested with an ad hoc userland
C program which checks the result of difftime for various pairs
of 32-bit and, for 64-bit builds, of 64-bit time_t values too.
The program was built and run against a glibc with and without
the patch, and the results compared to ensure the patch does
not change the behavior of difftime.

* include/time.h (__difftime64): Add.
* time/difftime.c (subtract): convert to 64-bit time.
* time/difftime.c (__difftime64): Add.
* time/difftime.c (__difftime): Wrap around __difftime64.
2018-12-20 22:16:55 +01:00
..
bits/types Use _STRUCT_TIMESPEC as guard in <bits/types/struct_timespec.h> [BZ #23349] 2018-06-28 13:12:16 +02:00
sys
adjtime.c
alt_digit.c
asctime.c
bug-asctime_r.c
bug-asctime.c
bug-getdate1.c
bug-mktime1.c
bug-mktime4.c mktime: new test for mktime failure 2018-11-15 22:59:33 +01:00
clock.c
clocktest.c
ctime_r.c Y2038: add function __ctime64_r 2018-12-18 23:13:55 +01:00
ctime.c Y2038: add function __ctime64 2018-12-18 23:13:24 +01:00
datemsk
Depend
difftime.c Y2038: make __difftime compatible with 64-bit time 2018-12-20 22:16:55 +01:00
dysize.c
era.c
ftime.c
getdate.c
getitimer.c
gettimeofday.c
gmtime.c Y2038: add function __gmtime64_r 2018-12-18 23:12:30 +01:00
lc-time-cleanup.c
localtime.c Y2038: add function __localtime64_r 2018-12-18 23:11:08 +01:00
Makefile mktime: new test for mktime failure 2018-11-15 22:59:33 +01:00
mktime-internal.h Fix mktime localtime offset confusion 2018-09-19 17:09:08 -07:00
mktime.c mktime: DEBUG_MKTIME cleanup 2018-11-15 22:59:33 +01:00
offtime.c Y2038: make __tz_convert compatible with 64-bit-time 2018-12-05 21:01:22 +01:00
setitimer.c
settimeofday.c
stime.c
strftime_l.c
strftime.c
strptime_l.c
strptime.c
test_time.c
time.c
time.h
timegm.c Merge mktime, timegm from upstream Gnulib 2018-09-19 17:09:08 -07:00
timespec_get.c
tst_wcsftime.c
tst-ftime_l.c
tst-ftime.c Don't reduce test timeout to less than default 2018-10-17 09:34:13 +02:00
tst-getdate.c
tst-mktime2.c time/tst-mktime2: Improve test error reporting 2018-10-23 11:25:05 +02:00
tst-mktime3.c
tst-mktime.c
tst-posixtz.c
tst-strftime.c
tst-strptime2.c
tst-strptime3.c
tst-strptime-whitespace.c
tst-strptime.c
tst-tzname.c
tst-y2039.c
tzfile.c Y2038: make __tz_convert compatible with 64-bit-time 2018-12-05 21:01:22 +01:00
tzset.c Y2038: make __tz_convert compatible with 64-bit-time 2018-12-05 21:01:22 +01:00
Versions
wcsftime_l.c
wcsftime.c