python-can icon indicating copy to clipboard operation
python-can copied to clipboard

kvaser timestamps broken since 4.4.1

Open johanb321 opened this issue 1 year ago • 2 comments

Describe the bug

Timestamps from kvaser messages are errouneous, due to the timestamp offset applied is incorrectly initialized in init function. Looks like the root cause is that the calls to canBusOn were moved in version 4.4.1 to now be done after the calls to kvReadTimer used to initialize the timestamp offset, this is causing the kvReadTimer to return a value that is not right (a way much bigger value than what is returned as timestamps on messages received later!).

To Reproduce

Check timestamps on received messages from _recv_internal function and compare them with the value of time.time() when the function returned, it should be close to zero but is not.

Expected behavior

Timestamps should be accurate and in sync with values returned by time.time()

Additional context

OS and version: Windows 10 Python version: 3.11.7 python-can version: 4.4.2 python-can interface/s (if applicable): Kvaser Leaf light v2

Traceback and logs
def func():
    return "hello, world!"

johanb321 avatar Oct 21 '24 06:10 johanb321

Thank you for reporting this. Can you confirm, that #1878 solves the issue?

zariiii9003 avatar Oct 21 '24 13:10 zariiii9003

Tried it out and it works just fine!

johanb321 avatar Oct 21 '24 19:10 johanb321