On 13.01.2011 18:35, Uwe Bonnes wrote:
> 
> Hello,
> 
> candump  -td gives ragged output if the delay varies,
> like:
>  (0.000000)  can0   6042008  [0]
>  (0.001025)  can0   7042008  [8] 28 B4 06 54 02 00 00 C0
>  (19.466085)  can0   6042008  [0]
>  (0.000973)  can0   7042008  [8] 28 B4 06 54 02 00 00 C0
> 
> 
> Appended Patch uses 6 digits for the second and gives and for delays shorter
> than a million seconds give a non ragged output like:
>  (     1.761128)  can0   604200F  [2] FF 81
>  (    49.032084)  can0   7042000  [8] 03 03 01 00 36 49 FF 81
>  (     0.001741)  can0   7042000  [8] 03 03 09 00 36 49 FF 81
> 
> Bye

Hello Uwe,

generally a reasonable idea. But your patch breaks the number of items
a shell script might expect to read when parsing a line.

What about

    printf("(%03ld.%06ld) ", diff.tv_sec, diff.tv_usec);

as i would not assume timestamp diff > 999 secs are relevant ?!?

And if you have an offset greater than 999 secs you probably want a
ragged output to detect the heavy offset ;-)

Regards,
Oliver

Index: can-utils/candump.c
===================================================================
--- can-utils/candump.c (Revision 1230)
+++ can-utils/candump.c (Arbeitskopie)
@@ -716,7 +716,7 @@
                                                diff.tv_sec--, diff.tv_usec += 
1000000;
                                        if (diff.tv_sec < 0)
                                                diff.tv_sec = diff.tv_usec = 0;
-                                       printf("(%ld.%06ld) ", diff.tv_sec, 
diff.tv_usec);
+                                       printf("(%6ld.%06ld) ", diff.tv_sec, 
diff.tv_usec);
                                
                                        if (timestamp == 'd')
                                                last_tv = tv; /* update for 
delta calculation */
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to