Fix off-by-one nanosecond in macro TIMESPEC_ADD.

Reviewed by: deischen
Approved by: re (dwhite)
MFC after  : 4 days
This commit is contained in:
David Xu 2005-06-22 22:35:49 +00:00
parent 5dea8a444f
commit 86a07ac068
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=147533
2 changed files with 2 additions and 2 deletions

View File

@ -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; \
} \

View File

@ -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; \
} \