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.
This commit is contained in:
Guy Harris 2021-06-28 00:42:06 -07:00 committed by Wireshark GitLab Utility
parent 1e04fb3001
commit c125236e57
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}