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
@@ -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) ");