Skip to contentSkip to conversation

SocketCAN timestamps

PATCH Applied Stefan Tatschner 3 participants 5 messages Nov 24, 2015 – Dec 10, 2015

Subsystems (3)
lore
Share & tools
lore
#1 lore raw
Quoted 7 lines · Stefan Tatschner

I did some google work to find out how to retrieve timestamps of received messages. I have found this:

http://socket-can.996257.n3.nabble.com/PATCH-Add-timestamps-description-to-can-txt-td1430.html

It seems that this patch has never been applied to the kernel tree. Are there any reasons (besides being forgotten) for this?

Maybe it was the time when mainlining the first bits and pieces to linux kernel. Can you port this patch against a current linux kernel?

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#2 lore raw

PATCH 1/1 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.

---
 Documentation/networking/can.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/networking/can.txt +9 -0
index 05fd83b..6ab619f 100644
@@ -372,6 +372,15 @@ solution for a couple of reasons:
     nbytes = sendto(s, &frame, sizeof(struct can_frame),
                     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:
 
   Generally the handling of CAN FD is very similar to the formerly described
Signature · 1 line
2.6.2
#3 lore raw

Re: [PATCH] can-doc: Add hint about getting timestamps

Quoted 6 lines · Stefan Tatschner

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.

Any comments on this patch?

Stefan

maintainer Applied
#4 lore raw

Re: [PATCH] can-doc: Add hint about getting timestamps

In reply to Stefan Tatschner
Quoted 4 lines · On Tue, 24 Nov 2015 15:06:29 +0100 Stefan Tatschner <[email protected]>…

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.

Applied to the docs tree, thanks.

jon