summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/time.c
diff options
context:
space:
mode:
authorgbcwbz <[email protected]>2022-06-05 22:51:22 +0800
committerGitHub <[email protected]>2022-06-05 22:51:22 +0800
commitecde6d2dcf12d9c5bf0d275bd13fedd1f84d5148 (patch)
tree7a4d227e3bc17bde0417e32557917d0ade5b1c16 /components/libc/compilers/common/time.c
parentb197b503c6f6b15eb1fcc627f445c969c3b0032a (diff)
[libc][time] Fix clock_gettime for CLOCK_CPUTIME_ID (#6029)
Diffstat (limited to 'components/libc/compilers/common/time.c')
-rw-r--r--components/libc/compilers/common/time.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 63b4746618..16387148f6 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -616,8 +616,8 @@ int clock_gettime(clockid_t clockid, struct timespec *tp)
unit = clock_cpu_getres();
cpu_tick = clock_cpu_gettime();
- tp->tv_sec = ((int)(cpu_tick * unit)) / NANOSECOND_PER_SECOND;
- tp->tv_nsec = ((int)(cpu_tick * unit)) % NANOSECOND_PER_SECOND;
+ tp->tv_sec = ((long long)(cpu_tick * unit)) / NANOSECOND_PER_SECOND;
+ tp->tv_nsec = ((long long)(cpu_tick * unit)) % NANOSECOND_PER_SECOND;
}
break;
#endif