From c125236e57178f6e8a3667fe04074c4a8e391066 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 28 Jun 2021 00:42:06 -0700 Subject: [PATCH] wslog: don't assume how big struct timeval's tv_usec is. At least according to the Single UNIX Standard, it merely has to be big enough to hold a value in the range [-1, 1000000], and there must be *an* environment in which it's no *larger* than a long. Just cast it to long, and continue to print the result of dividing it by 1000 with %03ld. --- wsutil/wslog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wsutil/wslog.c b/wsutil/wslog.c index 5622fea00a..7672e72c31 100644 --- a/wsutil/wslog.c +++ b/wsutil/wslog.c @@ -779,7 +779,7 @@ static const char *print_timestamp(char *buf, size_t size) if (now == NULL) return NOTIME; snprintf(buf, size, "%02d:%02d:%02d.%03ld", - now->tm_hour, now->tm_min, now->tm_sec, tv.tv_usec / 1000); + now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec / 1000); #endif return buf; }