Fix add_timespec

pull/460/head
ArthurKetels 2020-11-09 22:39:56 +01:00 committed by GitHub
parent d9261e801d
commit 4b4cdc2c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -164,7 +164,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;