Skip to content

Commit b3cc245

Browse files
committed
compute ns with rt_int64_t instead of int64_t in ctime.c
1 parent dc2bce7 commit b3cc245

File tree

1 file changed

+2
-2
lines changed
  • components/libc/compilers/common

1 file changed

+2
-2
lines changed

components/libc/compilers/common/ctime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
700700
if (err != RT_EOK)
701701
return err;
702702

703-
int64_t ns = rqtp->tv_nsec - ts.tv_nsec + (rqtp->tv_sec - ts.tv_sec) * NANOSECOND_PER_SECOND;
703+
rt_int64_t ns = rqtp->tv_nsec - ts.tv_nsec + (rt_int64_t)(rqtp->tv_sec - ts.tv_sec) * NANOSECOND_PER_SECOND;
704704
if (ns <= 0)
705705
return 0;
706706

@@ -1222,7 +1222,7 @@ int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
12221222
if (err != RT_EOK)
12231223
return err;
12241224

1225-
int64_t ns = value->it_value.tv_nsec - ts.tv_nsec + (value->it_value.tv_sec - ts.tv_sec) * NANOSECOND_PER_SECOND;
1225+
rt_int64_t ns = value->it_value.tv_nsec - ts.tv_nsec + (rt_int64_t)(value->it_value.tv_sec - ts.tv_sec) * NANOSECOND_PER_SECOND;
12261226

12271227
if (ns <= 0)
12281228
return 0;

0 commit comments

Comments
 (0)