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:
parent
bf3850c270
commit
1e503b5ca7
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue