lib: posix: clock: Fix nanosecond rollover logic

It was out by one count.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
This commit is contained in:
Nick Ward 2020-01-22 21:50:56 +11:00 committed by Johan Hedberg
commit 1e503b5ca7

View file

@ -49,7 +49,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *ts)
ts->tv_sec += base.tv_sec;
ts->tv_nsec += base.tv_nsec;
if (ts->tv_nsec > NSEC_PER_SEC) {
if (ts->tv_nsec >= NSEC_PER_SEC) {
ts->tv_sec++;
ts->tv_nsec -= NSEC_PER_SEC;
}