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:
parent
1e04fb3001
commit
c125236e57
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue