mirror of
https://github.com/linux-can/can-utils.git
synced 2026-09-22 08:06:34 +02:00
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:
+2
-2
@@ -363,8 +363,8 @@ int can2pty(int pty, int socket, int *tstamp)
|
||||
if (ioctl(socket, SIOCGSTAMP, &tv) < 0)
|
||||
perror("SIOCGSTAMP");
|
||||
|
||||
sprintf(&buf[ptr + 2*frame.can_dlc], "%04lX",
|
||||
(tv.tv_sec%60)*1000 + tv.tv_usec/1000);
|
||||
sprintf(&buf[ptr + 2*frame.can_dlc], "%04llX",
|
||||
(unsigned long long)(tv.tv_sec%60)*1000 + tv.tv_usec/1000);
|
||||
}
|
||||
|
||||
strcat(buf, "\r"); /* add terminating character */
|
||||
|
||||
Reference in New Issue
Block a user