Commit aecd89e8 authored by Stefan Tatschner's avatar Stefan Tatschner Committed by Jonathan Corbet

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: default avatarStefan Tatschner <rumpelsepp@sevenbyte.org>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent bcebb4cc
...@@ -372,6 +372,15 @@ solution for a couple of reasons: ...@@ -372,6 +372,15 @@ solution for a couple of reasons:
nbytes = sendto(s, &frame, sizeof(struct can_frame), nbytes = sendto(s, &frame, sizeof(struct can_frame),
0, (struct sockaddr*)&addr, sizeof(addr)); 0, (struct sockaddr*)&addr, sizeof(addr));
An accurate timestamp can be obtained with an ioctl(2) call after reading
a message from the socket:
struct timeval tv;
ioctl(s, SIOCGSTAMP, &tv);
The timestamp has a resolution of one microsecond and is set automatically
at the reception of a CAN frame.
Remark about CAN FD (flexible data rate) support: Remark about CAN FD (flexible data rate) support:
Generally the handling of CAN FD is very similar to the formerly described Generally the handling of CAN FD is very similar to the formerly described
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment