hardbyte / hardbyte/python-can
USB2CAN gs_usb timestamp in received CAN messages incorrect
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 697
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
I have an application on Windows 10 that sends and receives CAN bus messages and I am using a USB2CAN module by Inno-maker having installed python-can[gs-usb]. The application runs successfully using can.Notifier except that the timestamps in the received CAN bus messages are not correct. The timestamps, which are floating point values, are low (e.g. 331, 42) rather than being the number of seconds since the epoch. Does anyone have any advice as to how to correct this? I can stamp the messages in my application when they are forwarded to my listener instances by my can.Notifier instance but this is not ideal. The received CAN bus message timestamps were correct when the application ran on a Raspberry PI using CAN bus type ‘socketcan_ctypes'. Are the timestamps normally set in hardware? I see that the implementation of the GsUsb start function https://github.com/jxltom/gs_usb/blob/master/gs_usb/gs_usb.py has the GS_CAN_MODE_HW_TIMESTAMP flag.
### To Reproduce
Use Inno-maker USB2CAN module and python-can[gs-usb]. Timestamp in received CAN bus messages incorrect (date same as epoch)
### Expected behavior
Timestamp should be seconds as float since epoch
### Additional context
OS and version:Windows 10
Python version:Latest
python-can version:4.1.0
python-can interface/s (if applicable):
Traceback and logs
```python
def func():
return "hello, world!"
```
Contributor guide
Assessment
This issue has not been assessed yet.