[PATCH v2 4/7] y2038: Introduce struct __ntptimeval64 - new internal glibc type

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue May 19 19:10:45 GMT 2020



On 08/05/2020 11:56, Lukasz Majewski wrote:
> This type is a glibc's "internal" type to get time parameters data from
> Linux kernel (NTP daemon interface). It stores time in struct __timeval64
> rather than struct timeval, which makes it Y2038-proof.
> 
> Build tests:
> ./src/scripts/build-many-glibcs.py glibcs

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/include/sys/timex.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h
> index cf3059f63c..8c536b9a95 100644
> --- a/sysdeps/unix/sysv/linux/include/sys/timex.h
> +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h
> @@ -32,6 +32,7 @@ libc_hidden_proto (__adjtimex)
>  #   define __timex64 timex
>  #   define __clock_adjtime64 __clock_adjtime
>  #   define ___adjtimex64 ___adjtimex
> +#   define __ntptimeval64 ntptimeval
>  #  else
>  
>  struct __timex64
> @@ -77,6 +78,19 @@ extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64);
>  libc_hidden_proto (__clock_adjtime64);
>  extern int ___adjtimex64 (struct __timex64 *tx64);
>  libc_hidden_proto (___adjtimex64)
> +
> +struct __ntptimeval64
> +{
> +  struct __timeval64 time;	/* current time (ro) */
> +  long int maxerror;	/* maximum error (us) (ro) */
> +  long int esterror;	/* estimated error (us) (ro) */
> +  long int tai;		/* TAI offset (ro) */
> +
> +  long int __glibc_reserved1;
> +  long int __glibc_reserved2;
> +  long int __glibc_reserved3;
> +  long int __glibc_reserved4;
> +};
>  #  endif
>  
>  /* Convert a known valid struct timex into a struct __timex64.  */
> 


More information about the Libc-alpha mailing list