[PATCH 1/1] Y2038: make __mktime_internal compatible with __time64_t

Paul Eggert eggert@cs.ucla.edu
Wed Nov 21 17:49:00 GMT 2018


Albert ARIBAUD (3ADEV) wrote:
> +#if __TIMESIZE != 64
> +
> +/* The 32-bit-time wrapper.  */
> +time_t
> +mktime (struct tm *tp)

When this code is used in Gnulib in the obvious way, it defines another instance 
of 'mktime' which won't work. Also, this new instance of mktime uses a function 
fits_in_time_t, which isn't defined outside glibc. There is a similar problem 
with timegm.

A quick fix would be to change '#if __TIMESIZE != 64' to '#if defined _LIBC && 
__TIMESIZE != 64'. But we can take this opportunity to simplify mktime.c as per 
the attached patches. The first is for glibc and assumes the patches you already 
sent, and the second (for the record) is the resulting combined patch to Gnulib.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mktime.diff
Type: text/x-patch
Size: 1132 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20181121/34856026/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mktime-adjust-to-glibc-64-bit-changes.patch
Type: text/x-patch
Size: 8012 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20181121/34856026/attachment-0001.bin>


More information about the Libc-alpha mailing list