Thanks to visit codestin.com
Credit goes to github.com

Skip to content

kvaser timestamps broken since 4.4.1 #1877

@johanb321

Description

@johanb321

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!"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions