From 495206c5627975b2c1520b08ec0ca4c6fa831be6 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 2 Nov 2024 14:53:00 +0100 Subject: [PATCH] Fix #64: minor, type warnings in 64-bit time_t on 32-bit platforms - logit(), when formatting microsecond timestamp in stdout logging - scaletime(), used by mroutectl and others to dump time info Signed-off-by: Joachim Wiberg --- src/log.c | 4 ++-- src/main.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/log.c b/src/log.c index c58dff8..8ad340e 100644 --- a/src/log.c +++ b/src/log.c @@ -122,8 +122,8 @@ void logit(int severity, int syserr, const char *format, ...) thyme = localtime(&now_sec); // if (!debug) fprintf(stderr, "%s: ", log_name); - fprintf(stderr, "%02d:%02d:%02d.%03ld %s", thyme->tm_hour, - thyme->tm_min, thyme->tm_sec, now.tv_usec / 1000, msg); + fprintf(stderr, "%02d:%02d:%02d.%03d %s", thyme->tm_hour, + thyme->tm_min, thyme->tm_sec, (int)(now.tv_usec / 1000), msg); if (syserr == 0) fprintf(stderr, "\n"); else diff --git a/src/main.c b/src/main.c index 99e8efa..d7fcb14 100644 --- a/src/main.c +++ b/src/main.c @@ -635,7 +635,8 @@ char *scaletime(time_t t) else buf = buf1; - snprintf(p, SCALETIMEBUFLEN, "%2ld:%02ld:%02ld", t / 3600, (t % 3600) / 60, t % 60); + snprintf(p, SCALETIMEBUFLEN, "%2d:%02d:%02d", (int)(t / 3600), + (int)((t % 3600) / 60), (int)(t % 60)); return p; }