Skip to content

Commit

Permalink
Fix add_timespec in other codes besides red_test (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
windsgo authored Mar 21, 2024
1 parent 1817b8b commit d478bce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/linux/ebox/ebox.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/win32/ebox/ebox.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d478bce

Please sign in to comment.