cansniffer: fix gap calculation output

The gap between two consecutive frames of a specific has been calculated in
handle_timeo() instead of handle_bcm() which lead to values that where
at minimum the loop time of the display refresh.

The effect can be seen when displaying a 10ms gap CAN frame with a 200ms
display refresh (option -l 20 => default) in opposite to a 10ms display
refresh (option -l 1).

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
pull/201/head
Oliver Hartkopp 2020-04-26 08:30:55 +02:00
parent 6cdccbbafc
commit eb639c1b3d
1 changed files with 1 additions and 1 deletions

View File

@ -506,6 +506,7 @@ int handle_bcm(int fd, long currcms){
} }
id = bmsg.msg_head.can_id; id = bmsg.msg_head.can_id;
sniftab[id].laststamp = sniftab[id].currstamp;
ioctl(fd, SIOCGSTAMP, &sniftab[id].currstamp); ioctl(fd, SIOCGSTAMP, &sniftab[id].currstamp);
if (bmsg.msg_head.opcode != RX_CHANGED) { if (bmsg.msg_head.opcode != RX_CHANGED) {
@ -587,7 +588,6 @@ int handle_timeo(int fd, long currcms){
} }
} }
sniftab[i].last = sniftab[i].current; sniftab[i].last = sniftab[i].current;
sniftab[i].laststamp = sniftab[i].currstamp;
} }
} }