Optional nanosecond timestamp logging #592
Conversation
|
I think we're not allowed to change the output for the Otherwise this is a good enhancement for the hardware timestamps. |
|
Yes. The 6 decimal places are fix in the CAN log file format for 20+ years now. And having the maximum rate of CAN frames on the CAN bus in mind we are already far beyond what is needed as a timestamp precision. Of course everyone might use a higher precision from timespec inside a SocketCAN application - but we have to stay with 6 decimal places in the log file format. |
|
We are using MCP2518FD with 25ns resolution and are planning to correlate that to PTP time. |
|
@RikusW Can you elaborate on you use case a but more, I have some proof of concept patches that implement a PTP clock for the mcp251xfd driver. |
|
@marckleinebudde We will be using 8 CAN ports with all of them exactly in sync and will be doing the PTP part in userspace for now. I'm working on https://tsn.systems/en/products/basicsolution/tsn-basicsolution-octocan/ |
|
I'm not generally against creating a new log file format flavor that supports a nanosecond resolution with a |
|
For now I just need to be able to view nanosecond timestamps, transmit/replay ability could be done at a later time even. |
|
Let's hold this PR in mind until it is completed with the other tools then. |
|
I've re-based onto the newest master and added us/ns auto detection. |
|
Squashed into a single commit |
|
Looks like libc broke in some test setups... |
yes - debian and ubuntu have some problems. |
At least it is not my patch that is the problem here... |
|
ACK |
|
Any news on the broken distributions ? |
|
|
||
| /* | ||
| * ensure the fractions of seconds are 6 or 9 decimal places long to catch | ||
| * 3rd party or handcrafted logfiles that treat the timestamp as float |
There was a problem hiding this comment.
I would prefer a comment that talks about nanoseconds instead of float.
There was a problem hiding this comment.
I kept this comment the same as in canplayer.c except for adding "or 9"
| } | ||
|
|
||
| if (sscanf(buf, "(%llu.%llu) %s %s", &sec, &usec, device, afrbuf) != 4) { | ||
| if (sscanf(buf, "(%llu.%llu) %21s %6299s", &sec, &usec, device, afrbuf) != 4) { |
There was a problem hiding this comment.
limiting the string reading is a good idea but is not in the scope of this patch.
Please create a separate patch with a separate commit message for it.
There was a problem hiding this comment.
Removed this, I can squash, or it can be squashed when merging ?
|
Looks like the 2 failing checks is the distribution build system failing and unrelated to this patch ? |
|
@hartkopp What do you think about this patch? |
|
Sorry. Yes, I think it's a good work an can be merged. |
Use timespec instead of timeval so timestamp values with nanosecond resolution can be displayed.