mirror of
https://github.com/apache/nuttx.git
synced 2026-09-21 05:14:27 +08:00
clock_gettime.c: Fix a cornercase bug in clock_gettime()
This commit is contained in:
@@ -150,7 +150,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
||||
|
||||
/* Handle carry to seconds. */
|
||||
|
||||
if (ts.tv_nsec > NSEC_PER_SEC)
|
||||
if (ts.tv_nsec >= NSEC_PER_SEC)
|
||||
{
|
||||
carry = ts.tv_nsec / NSEC_PER_SEC;
|
||||
ts.tv_sec += carry;
|
||||
|
||||
Reference in New Issue
Block a user