Skip to content

Commit aecd89e

Browse files
Stefan TatschnerJonathan Corbet
authored andcommitted
can-doc: Add hint about getting timestamps
This patch adds a hint about how to get timestamps of received CAN frames with ioctl(2). This hint has been applied to the former SocketCAN Documentation, but it got lost during mainlining the first bits and pieces to linux kernel. Signed-off-by: Stefan Tatschner <rumpelsepp@sevenbyte.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent bcebb4c commit aecd89e

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎Documentation/networking/can.txt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,15 @@ solution for a couple of reasons:
372372
nbytes = sendto(s, &frame, sizeof(struct can_frame),
373373
0, (struct sockaddr*)&addr, sizeof(addr));
374374

375+
An accurate timestamp can be obtained with an ioctl(2) call after reading
376+
a message from the socket:
377+
378+
struct timeval tv;
379+
ioctl(s, SIOCGSTAMP, &tv);
380+
381+
The timestamp has a resolution of one microsecond and is set automatically
382+
at the reception of a CAN frame.
383+
375384
Remark about CAN FD (flexible data rate) support:
376385

377386
Generally the handling of CAN FD is very similar to the formerly described

0 commit comments

Comments
 (0)