]> git.ipfire.org Git - pakfire.git/commitdiff
util: Return converted timestamps as long
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Mar 2025 16:48:17 +0000 (16:48 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Mar 2025 16:48:17 +0000 (16:48 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/daemon.c
src/pakfire/util.h

index a440209ce32e8f2538994e0709a2df22eaac3e15..3974dfc4633b931547fa3aaba15127d30a13003f 100644 (file)
@@ -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
index e72ffea71e03fbf1bcffcbb17e2c9e9ad54271ec..01c44a1f56e43ce1a3161ba0344548e7c2f85fbf 100644 (file)
@@ -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