timestamp formatting: always use 64-bit for timesstamp formatting.

Using C99 `unsigned long long` to format `struct timeval`'s `tv_sec`
and `tv_usec`, fix incorrect print under some 32bit platform which
 using time64.
This commit is contained in:
TyK
2023-11-28 08:30:27 +08:00
parent 97c8ccdbbf
commit ceda93bd5c
11 changed files with 58 additions and 42 deletions
+2 -2
View File
@@ -415,8 +415,8 @@ int main(int argc, char **argv)
idx = idx2dindex(addr.can_ifindex, s[i]);
sprintf(temp, "(%lu.%06lu) %*s ",
tv.tv_sec, tv.tv_usec, max_devname_len, devname[idx]);
sprintf(temp, "(%llu.%06llu) %*s ",
(unsigned long long)tv.tv_sec, (unsigned long long)tv.tv_usec, max_devname_len, devname[idx]);
sprint_canframe(temp+strlen(temp), &frame, 0, maxdlen);
strcat(temp, "\n");