From 6e24b08bdd1609fc46ecd402b30f6081f5b81014 Mon Sep 17 00:00:00 2001 From: Jean-Roland Date: Fri, 20 Dec 2024 09:14:47 +0100 Subject: [PATCH] fix: time wconversion errors --- src/system/unix/system.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/system/unix/system.c b/src/system/unix/system.c index 2fcf2b3c8..3a92f2b9d 100644 --- a/src/system/unix/system.c +++ b/src/system/unix/system.c @@ -211,8 +211,8 @@ unsigned long z_clock_elapsed_s(z_clock_t *instant) { } void z_clock_advance_us(z_clock_t *clock, unsigned long duration) { - clock->tv_sec += duration / 1000000; - clock->tv_nsec += (duration % 1000000) * 1000; + clock->tv_sec += (time_t)(duration / 1000000); + clock->tv_nsec += (long int)((duration % 1000000) * 1000); if (clock->tv_nsec >= 1000000000) { clock->tv_sec += 1; @@ -221,8 +221,8 @@ void z_clock_advance_us(z_clock_t *clock, unsigned long duration) { } void z_clock_advance_ms(z_clock_t *clock, unsigned long duration) { - clock->tv_sec += duration / 1000; - clock->tv_nsec += (duration % 1000) * 1000000; + clock->tv_sec += (time_t)(duration / 1000); + clock->tv_nsec += (long int)((duration % 1000) * 1000000); if (clock->tv_nsec >= 1000000000) { clock->tv_sec += 1; @@ -230,7 +230,7 @@ void z_clock_advance_ms(z_clock_t *clock, unsigned long duration) { } } -void z_clock_advance_s(z_clock_t *clock, unsigned long duration) { clock->tv_sec += duration; } +void z_clock_advance_s(z_clock_t *clock, unsigned long duration) { clock->tv_sec += (time_t)duration; } /*------------------ Time ------------------*/ z_time_t z_time_now(void) {