diff options
| author | gbcwbz <[email protected]> | 2022-06-05 22:51:22 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-05 22:51:22 +0800 |
| commit | ecde6d2dcf12d9c5bf0d275bd13fedd1f84d5148 (patch) | |
| tree | 7a4d227e3bc17bde0417e32557917d0ade5b1c16 /components | |
| parent | b197b503c6f6b15eb1fcc627f445c969c3b0032a (diff) | |
[libc][time] Fix clock_gettime for CLOCK_CPUTIME_ID (#6029)
Diffstat (limited to 'components')
| -rw-r--r-- | components/libc/compilers/common/time.c | 4 |
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 |
