Hi all,
I have been trying to use the timestamp in the NativeEventHandler to detect the time elapsed between two external events.
On an Arduino I would just set-up a timer with input capture, read the input capture register and subtract the previous value to get the elapsed time. That would give me a count in ticks relative to the 16 MHz clock frequency.
The NativeEventHandler is specified to have a timestamp of the time at the occurrence of the event. But Is that a timestamp in ms only? I have seen mentioned that DateTime is only measured in ms and therefore the ticks count is not accurate.
However, I have tried to use the "ticks" from DateTime, which is specified on MSDN to be 10.000 ticks/ms, but I'm not sure if I get an accurate time (oldDateTime.ticks - newDateTime.ticks = elapsedTime).
Also when I do read the number of ticks elapsed, the last digit is always zero. Indicating a resolution of ticks as 1.000 ticks/ms and not 10.000.
Can someone enlighten me as to what the accuracy of the timestamp in NativeEventHandler is.
I need an accuracy between events, much better than 1 ms (on the Arduino Leonardo I can detect better than 0.001 ms. Just for illustration).
Maybe I should be doing this differently. All suggestions are welcome.
/Martin