From d478bce787d2f860f8582240ee26afe78fcbad25 Mon Sep 17 00:00:00 2001 From: Windsgo <18221102427@163.com> Date: Thu, 21 Mar 2024 14:51:29 +0800 Subject: [PATCH] Fix `add_timespec` in other codes besides `red_test` (#794) --- test/linux/ebox/ebox.c | 2 +- test/win32/ebox/ebox.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/linux/ebox/ebox.c b/test/linux/ebox/ebox.c index 68e0e6a8..26287346 100644 --- a/test/linux/ebox/ebox.c +++ b/test/linux/ebox/ebox.c @@ -250,7 +250,7 @@ void add_timespec(struct timespec *ts, int64 addtime) sec = (addtime - nsec) / NSEC_PER_SEC; ts->tv_sec += sec; ts->tv_nsec += nsec; - if ( ts->tv_nsec > NSEC_PER_SEC ) + if ( ts->tv_nsec >= NSEC_PER_SEC ) { nsec = ts->tv_nsec % NSEC_PER_SEC; ts->tv_sec += (ts->tv_nsec - nsec) / NSEC_PER_SEC; diff --git a/test/win32/ebox/ebox.c b/test/win32/ebox/ebox.c index 7d232bf7..cd1fb422 100644 --- a/test/win32/ebox/ebox.c +++ b/test/win32/ebox/ebox.c @@ -250,7 +250,7 @@ void add_timespec(struct timespec *ts, int64 addtime) sec = (addtime - nsec) / NSEC_PER_SEC; ts->tv_sec += sec; ts->tv_nsec += nsec; - if ( ts->tv_nsec > NSEC_PER_SEC ) + if ( ts->tv_nsec >= NSEC_PER_SEC ) { nsec = ts->tv_nsec % NSEC_PER_SEC; ts->tv_sec += (ts->tv_nsec - nsec) / NSEC_PER_SEC;