Skip to content

Commit

Permalink
Fix #64: minor, type warnings in 64-bit time_t on 32-bit platforms
Browse files Browse the repository at this point in the history
 - logit(), when formatting microsecond timestamp in stdout logging
 - scaletime(), used by mroutectl and others to dump time info

Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Nov 2, 2024
1 parent 351db5d commit 495206c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 495206c

Please sign in to comment.