Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

python-can doesn't appear to be using hardware timestamps with socketcan

未关闭
#1,881 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
linux, python

调研方向

首先,在使用标准内核驱动的 Debian 12 上重现 candump -ta -H can1python -m can.logger -c can1 之间的比较。检查 SocketCAN 接收路径和 logger 入口点,以确定时间戳是如何获取的。完成标准是:在可用时使用硬件时间戳,并且捕获的时序与文档化的行为一致;如果现有测试结构支持,还应包含回归测试覆盖。

由索引模型根据 Issue 内容生成。

描述

bug
Describe the bug
To Reproduce

Run two captures at the same time, one using candump with hardware timestamps :

candump -ta -H can1

The other utilising python-can e.g. logger :

python -m can.logger -c can1

If you then dump the output into a spreadsheet and compare frames, the output is quite different. For example, on a cyclic message on our hardware, I can see the cycle with candump -H is stable +/- 5 microseconds. With the timestamps from python-can the variance seems to be +/- 900 microseconds.

Expected behavior

The python can docs say :

The timestamp field in a CAN message is a floating point number representing when the message was received since the epoch in seconds. Where possible this will be timestamped in hardware.

So I'd have expected the hardware timestamps to have been enabled as with candump -H.

Additional context

OS and version: Debian 12 (6.1.112-1)
Python version: 3.11
python-can version: 4.4.2
python-can interface/s (if applicable): Peak PCAN-USB X6

We're using the standard kernel drivers not peak's custom drivers.

Traceback and logs
主要语言
Python
星标
1.6k
派生
697
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hardbyte/python-can 的其他 Issue

查看 hardbyte/python-can 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。