From 86a07ac0685eca0d7b9b01101df45ac559802b3c Mon Sep 17 00:00:00 2001 From: David Xu Date: Wed, 22 Jun 2005 22:35:49 +0000 Subject: [PATCH] Fix off-by-one nanosecond in macro TIMESPEC_ADD. Reviewed by: deischen Approved by: re (dwhite) MFC after : 4 days --- lib/libkse/thread/thr_private.h | 2 +- lib/libpthread/thread/thr_private.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libkse/thread/thr_private.h b/lib/libkse/thread/thr_private.h index c6290384c9d..e2055bc1da6 100644 --- a/lib/libkse/thread/thr_private.h +++ b/lib/libkse/thread/thr_private.h @@ -106,7 +106,7 @@ do { \ (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \ (dst)->tv_nsec = (src)->tv_nsec + (val)->tv_nsec; \ - if ((dst)->tv_nsec > 1000000000) { \ + if ((dst)->tv_nsec >= 1000000000) { \ (dst)->tv_sec++; \ (dst)->tv_nsec -= 1000000000; \ } \ diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h index c6290384c9d..e2055bc1da6 100644 --- a/lib/libpthread/thread/thr_private.h +++ b/lib/libpthread/thread/thr_private.h @@ -106,7 +106,7 @@ do { \ (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \ (dst)->tv_nsec = (src)->tv_nsec + (val)->tv_nsec; \ - if ((dst)->tv_nsec > 1000000000) { \ + if ((dst)->tv_nsec >= 1000000000) { \ (dst)->tv_sec++; \ (dst)->tv_nsec -= 1000000000; \ } \