[PATCH 6/7] nptl/tst-rwlock: Use clock_gettime/timespec rather than gettimeofday/timeval
Yann Droneaud
ydroneaud@opteya.com
Thu Mar 14 14:44:00 GMT 2019
Hi,
Le mercredi 27 février 2019 à 18:23 +0000, Mike Crowe a écrit :
> diff --git a/nptl/tst-rwlock9.c b/nptl/tst-rwlock9.c
> index 34f2d04..ff15f90 100644
> --- a/nptl/tst-rwlock9.c
> +++ b/nptl/tst-rwlock9.c
> @@ -56,9 +56,7 @@ writer_thread (void *nr)
> int e;
> do
> {
> - struct timeval tv;
> - (void) gettimeofday (&tv, NULL);
> - TIMEVAL_TO_TIMESPEC (&tv, &ts);
> + (void) clock_gettime (CLOCK_REALTIME, &ts);
>
> ts.tv_nsec += 2 * TIMEOUT;
> if (ts.tv_nsec >= 1000000000)
Should timespec_add() be used here too ?
> @@ -110,9 +108,7 @@ reader_thread (void *nr)
> int e;
> do
> {
> - struct timeval tv;
> - (void) gettimeofday (&tv, NULL);
> - TIMEVAL_TO_TIMESPEC (&tv, &ts);
> + (void) clock_gettime (CLOCK_REALTIME, &ts);
>
> ts.tv_nsec += TIMEOUT;
> if (ts.tv_nsec >= 1000000000)
Same here
Regards.
--
Yann Droneaud
OPTEYA
More information about the Libc-alpha
mailing list