This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC v3 04/23] sysdeps/clock_gettime: Use clock_gettime64 if avaliable
On Jul 16 2019, Alistair Francis <alistair.francis@wdc.com> wrote:
> diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
> index 5fc47fb7dc..4832069c34 100644
> --- a/sysdeps/unix/sysv/linux/clock_gettime.c
> +++ b/sysdeps/unix/sysv/linux/clock_gettime.c
> @@ -27,10 +27,40 @@
> #include <sysdep-vdso.h>
>
> /* Get current value of CLOCK and store it in TP. */
> +
> +#if __WORDSIZE == 32
> +int
> +__clock_gettime (clockid_t clock_id, struct timespec *tp)
> +{
> + int ret;
> +
> +#ifdef __NR_clock_gettime64
> + struct __timespec64 tp64;
> + ret = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, &tp64);
> +
> + tp->tv_sec = tp64.tv_sec;
> + tp->tv_nsec = tp64.tv_nsec;
This needs to check if clock_gettime64 was successful.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."