From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125221 invoked by alias); 7 Feb 2020 16:56:39 -0000 Mailing-List: contact glibc-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: glibc-cvs-owner@sourceware.org List-Subscribe: Received: (qmail 124485 invoked by uid 10238); 7 Feb 2020 16:56:38 -0000 Date: Fri, 07 Feb 2020 16:56:00 -0000 Message-ID: <20200207165638.124484.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Lukasz Majewski To: glibc-cvs@sourceware.org Subject: [glibc] y2038: Introduce struct __timeval64 - new internal glibc type X-Act-Checkin: glibc X-Git-Author: Lukasz Majewski X-Git-Refname: refs/heads/master X-Git-Oldrev: 3fced064f23562ec24f8312ffbc14950993969e6 X-Git-Newrev: 504c98717062cb9bcbd4b3e59e932d04331ddca5 X-SW-Source: 2020-q1/txt/msg00248.txt https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=504c98717062cb9bcbd4b3e59e932d04331ddca5 commit 504c98717062cb9bcbd4b3e59e932d04331ddca5 Author: Lukasz Majewski Date: Thu Jan 16 23:40:51 2020 +0100 y2038: Introduce struct __timeval64 - new internal glibc type This type is a glibc's "internal" type similar to struct timeval but whose tv_sec field is a __time64_t rather than a time_t, which makes it Y2038-proof. This struct is NOT supposed to be passed to the kernel - instead it shall be converted to struct __timespec64 and clock_[sg]ettime syscalls shall be used (which are now Y2038 safe). Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis Reviewed-by: Adhemerval Zanella Diff: --- include/time.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/time.h b/include/time.h index 97d17c1..e3afd6e 100644 --- a/include/time.h +++ b/include/time.h @@ -94,6 +94,20 @@ struct __itimerspec64 #endif #if __TIMESIZE == 64 +# define __timeval64 timeval +#else +/* The glibc Y2038-proof struct __timeval64 structure for a time value. + This structure is NOT supposed to be passed to the Linux kernel. + Instead, it shall be converted to struct __timespec64 and time shall + be [sg]et via clock_[sg]ettime (which are now Y2038 safe). */ +struct __timeval64 +{ + __time64_t tv_sec; /* Seconds */ + __suseconds64_t tv_usec; /* Microseconds */ +}; +#endif + +#if __TIMESIZE == 64 # define __ctime64 ctime #else extern char *__ctime64 (const __time64_t *__timer) __THROW;