candump: Avoid ragged output of timestamp values when printing differential

timestamps (commandline option -td).
Idea & original patch by Uwe Bonnes.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
pull/7/head
Oliver Hartkopp 2011-01-19 17:43:07 +00:00
parent d262a552bb
commit c9e79e55c3
1 changed files with 1 additions and 1 deletions

View File

@ -716,7 +716,7 @@ int main(int argc, char **argv)
diff.tv_sec--, diff.tv_usec += 1000000; diff.tv_sec--, diff.tv_usec += 1000000;
if (diff.tv_sec < 0) if (diff.tv_sec < 0)
diff.tv_sec = diff.tv_usec = 0; diff.tv_sec = diff.tv_usec = 0;
printf("(%ld.%06ld) ", diff.tv_sec, diff.tv_usec); printf("(%03ld.%06ld) ", diff.tv_sec, diff.tv_usec);
if (timestamp == 'd') if (timestamp == 'd')
last_tv = tv; /* update for delta calculation */ last_tv = tv; /* update for delta calculation */