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
@@ -403,9 +403,9 @@ int main(int argc, char **argv)
|
||||
|
||||
/* check devisor to be not zero */
|
||||
if (diff_tv.tv_sec * 1000 + diff_tv.tv_usec / 1000){
|
||||
printf("%lu.%06lus ", diff_tv.tv_sec, diff_tv.tv_usec);
|
||||
printf("%llu.%06llus ", (unsigned long long)diff_tv.tv_sec, (unsigned long long)diff_tv.tv_usec);
|
||||
printf("=> %lu byte/s", (fflen * 1000) /
|
||||
(diff_tv.tv_sec * 1000 + diff_tv.tv_usec / 1000));
|
||||
(unsigned long)(diff_tv.tv_sec * 1000 + diff_tv.tv_usec / 1000));
|
||||
} else
|
||||
printf("(no time available) ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user