This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v5] Y2038: make __difftime compatible with 64-bit time
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Albert ARIBAUD (3ADEV)" <albert dot aribaud at 3adev dot fr>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 21 Dec 2018 10:47:14 -0800
- Subject: Re: [PATCH v5] Y2038: make __difftime compatible with 64-bit time
- References: <20181220204041.9377-1-albert.aribaud@3adev.fr>
On Thu, Dec 20, 2018 at 12:40 PM Albert ARIBAUD (3ADEV)
<albert.aribaud@3adev.fr> wrote:
>
> 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.
> ---
This caused:
https://sourceware.org/bugzilla/show_bug.cgi?id=24023
--
H.J.