Fix `add_timespec` in other codes besides `red_test` (#794)
This commit is contained in:
parent
1817b8b4fe
commit
d478bce787
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue