From d714e5bf2ce7333236aae069780e849db4ef0771 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 26 Mar 2025 16:48:17 +0000 Subject: [PATCH] util: Return converted timestamps as long Signed-off-by: Michael Tremer --- src/pakfire/daemon.c | 2 +- src/pakfire/util.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pakfire/daemon.c b/src/pakfire/daemon.c index a440209c..3974dfc4 100644 --- a/src/pakfire/daemon.c +++ b/src/pakfire/daemon.c @@ -678,7 +678,7 @@ static int pakfire_daemon_close(struct pakfire_xfer* xfer, int code, void* data) daemon->control = NULL; } - INFO(daemon->ctx, "Will attempt to reconnect in %u second(s)\n", + INFO(daemon->ctx, "Will attempt to reconnect in %lu second(s)\n", daemon->reconnect_holdoff / S_TO_US(1)); // Set the reconnection timer diff --git a/src/pakfire/util.h b/src/pakfire/util.h index e72ffea7..01c44a1f 100644 --- a/src/pakfire/util.h +++ b/src/pakfire/util.h @@ -97,15 +97,15 @@ int pakfire_fd_set_non_blocking(struct pakfire_ctx* ctx, int fd); // Time // seconds to microseconds -#define S_TO_MS(s) (s * 1000) -#define S_TO_US(s) (s * 1000000) -#define S_TO_NS(s) (s * 1000000000) +#define S_TO_MS(s) ((s) * 1000UL) +#define S_TO_US(s) ((s) * 1000000UL) +#define S_TO_NS(s) ((s) * 1000000000UL) -#define MS_TO_S(s) (s / 1000) -#define US_TO_S(s) (s / 1000000) -#define NS_TO_S(s) (s / 1000000000) +#define MS_TO_S(s) ((s) / 1000) +#define US_TO_S(s) ((s) / 1000000) +#define NS_TO_S(s) ((s) / 1000000000) -#define US_TO_MS(us) (us / 1000) +#define US_TO_MS(us) ((us) / 1000) static inline double pakfire_timespec_delta(struct timespec* t1, struct timespec* t2) { // Compute delta in seconds -- 2.39.5