Fix compile issue with clock_t conversion (#1200)

We don't enable -Wconversion on the kitchen-sink build. But it's
enabled for some tinyusb examples.
This commit is contained in:
Peter Harper 2023-01-26 19:11:42 +00:00 committed by GitHub
parent b979395c5e
commit 67af83f069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -236,9 +236,9 @@ __attribute((weak)) int settimeofday(__unused const struct timeval *tv, __unused
__attribute((weak)) int _times(struct tms *tms) {
#if CLOCKS_PER_SEC >= 1000000
tms->tms_utime = to_us_since_boot(get_absolute_time()) * (CLOCKS_PER_SEC / 1000000);
tms->tms_utime = (clock_t)(to_us_since_boot(get_absolute_time()) * (CLOCKS_PER_SEC / 1000000));
#else
tms->tms_utime = to_us_since_boot(get_absolute_time()) / (1000000 / CLOCKS_PER_SEC);
tms->tms_utime = (clock_t)(to_us_since_boot(get_absolute_time()) / (1000000 / CLOCKS_PER_SEC));
#endif
tms->tms_stime = 0;
tms->tms_cutime = 0;