From f6070476687af9ca1b5837f8a45047acdd419b08 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 5 Jun 2020 09:43:13 -0700 Subject: Update HP_TIMING_NOW for _ISOMAC in sysdeps/generic/hp-timing.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit e9698175b0b60407db1e89bcf29437ab224bca0b Author: Lukasz Majewski Date: Mon Mar 16 08:31:41 2020 +0100 y2038: Replace __clock_gettime with __clock_gettime64 breaks benchtests with sysdeps/generic/hp-timing.h: In file included from ./bench-timing.h:23, from ./bench-skeleton.c:25, from /export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/benchtests/bench-rint.c:45: ./bench-skeleton.c: In function ‘main’: ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’ isn’t known 37 | struct __timespec64 tv; \ | ^~ Define HP_TIMING_NOW with clock_gettime in sysdeps/generic/hp-timing.h if _ISOMAC is defined. Don't define __clock_gettime in bench-timing.h since it is no longer needed. Reviewed-by: Carlos O'Donell --- sysdeps/generic/hp-timing.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sysdeps/generic/hp-timing.h') diff --git a/sysdeps/generic/hp-timing.h b/sysdeps/generic/hp-timing.h index af9d92f7f7..1960a71c62 100644 --- a/sysdeps/generic/hp-timing.h +++ b/sysdeps/generic/hp-timing.h @@ -32,11 +32,20 @@ typedef uint64_t hp_timing_t; /* The clock_gettime (CLOCK_MONOTONIC) has unspecified starting time, nano-second accuracy, and for some architectues is implemented as vDSO symbol. */ -#define HP_TIMING_NOW(var) \ +#ifdef _ISOMAC +# define HP_TIMING_NOW(var) \ +({ \ + struct timespec tv; \ + clock_gettime (CLOCK_MONOTONIC, &tv); \ + (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \ +}) +#else +# define HP_TIMING_NOW(var) \ ({ \ struct __timespec64 tv; \ __clock_gettime64 (CLOCK_MONOTONIC, &tv); \ (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \ }) +#endif #endif /* hp-timing.h */ -- cgit 1.4.1