[libc][time] Fix clock_gettime for CLOCK_CPUTIME_ID (#6029)

This commit is contained in:
gbcwbz 2022-06-05 22:51:22 +08:00 committed by GitHub
parent b197b503c6
commit ecde6d2dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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