From 67af83f0694e733b21e04889599019b97d172018 Mon Sep 17 00:00:00 2001 From: Peter Harper <77111776+peterharperuk@users.noreply.github.com> Date: Thu, 26 Jan 2023 19:11:42 +0000 Subject: [PATCH] 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. --- src/rp2_common/pico_runtime/runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c index c4d1684..f9018d0 100644 --- a/src/rp2_common/pico_runtime/runtime.c +++ b/src/rp2_common/pico_runtime/runtime.c @@ -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;