Hello
I'm creating a c# application for monitoring CAN messages and also sending them. I have a receive window which also captures the messages I'm sending out. The problems is the messages I'm writing don't have a timestamp when I look at them in my receive window.
I'm fine with making my own timestamp but I feel like I'm missing something in my understanding of the timestamp struct.
I do this => Total Microseconds = micros + 1000 * millis + 0x100000000 * 1000 * millis_overflow
to get the total microseconds but this is total microseconds from when? I'm hoping to get some more context on what is actually going on with TPCANTimestamp so I can mimic it and also do something more interesting with it in my receive window.
Thanks
TPCANTimestamp question
Re: TPCANTimestamp question
Hello,
the answer is in the same page of the help documentation from where you have the way for microseconds calculation:
the answer is in the same page of the help documentation from where you have the way for microseconds calculation:
Best regards,
Keneth
Keneth
-
- Posts: 4
- Joined: Wed 10. Jul 2019, 22:01
Re: TPCANTimestamp question
I can't find any kind of consistency in what TPCANTimestamp is giving me. The number of digits varies from 10 to 6 and comparing it with any other method of creating a time stamp doesn't help either.
Re: TPCANTimestamp question
Hello,
our APIs and drivers work with high-resolution timestamps, with a precision of 1 millisecond. They use QueryPerformanceFrequency and QueryPerformanceCounter for Timestamp generation. As far as I know, C# doesn't offer these functions, but it has a class, StopWatch (System.Diagnostics), that may also be used for timestamps acquisition. You can try using StopWatch or using PInvoke for the funcitons mentioned above.
Note: when getting a timestamp before passing a message to the CAN_Write function is still not the real time of message-sending. The message is first placed in the send-queue of the driver.
our APIs and drivers work with high-resolution timestamps, with a precision of 1 millisecond. They use QueryPerformanceFrequency and QueryPerformanceCounter for Timestamp generation. As far as I know, C# doesn't offer these functions, but it has a class, StopWatch (System.Diagnostics), that may also be used for timestamps acquisition. You can try using StopWatch or using PInvoke for the funcitons mentioned above.
Note: when getting a timestamp before passing a message to the CAN_Write function is still not the real time of message-sending. The message is first placed in the send-queue of the driver.
Best regards,
Keneth
Keneth
-
- Posts: 4
- Joined: Wed 10. Jul 2019, 22:01
Re: TPCANTimestamp question
It's been awhile since I posted this question but you were helpful in me figuring out a solution to my issue. Thank you.