Skip to content

fix(pcan): preserve Linux epoch timestamps without boot offset - #2119

Merged
zariiii9003 merged 4 commits into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:fix/2108-pcan-linux-epoch
Nov 23, 2026
Merged

zariiii9003 merged 4 commits into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:fix/2108-pcan-linux-epoch

Conversation

@timothyanderson096-ocdealcheck

@timothyanderson096-ocdealcheck timothyanderson096-ocdealcheck commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

Preserve PCAN-Basic's Linux Unix-epoch timestamps for classic CAN and CAN FD. Select a zero boot offset on Linux, bypassing the irrelevant uptime import/lookup/warning; retain the complete existing conversion and fallback on other platforms. Add focused platform/clock controls, documentation and a news fragment.

Related Issues / Pull Requests

Closes #2108. Thanks to @rodrigocarbonell-creator for the report and clock-domain diagnosis. PEAK's timestamp documentation distinguishes Windows system-start timestamps from Linux epoch timestamps. The original preparation also inspected the Linux 5.0.1.8 source/addendum; no vendor code is redistributed. Current #1901 changes bus-state names, not this clock conversion.

Type of Change

  • Bug fix
  • Documentation update

Checklist

  • Contribution guide followed.
  • Tests, documentation and news fragment added.
  • All checks and tests pass (tox).

Additional Notes

Hosted CI — current head (23 November 2026)

At merge-resolution head 42859a5, the Tests workflow #45089058625 completed successfully: 25 jobs passed, including the Ubuntu/Windows/macOS Python test matrix, lint/static analysis, docs, packaging and coverage aggregation; the release-publishing job was skipped. The merge from upstream main preserves the PCAN timestamp fix and retains upstream's more specific ImportError handling. GitHub reports the PR mergeable. The local tox checklist item remains unchecked because a new complete local tox run was not performed.

Historical validation of the earlier, expanded test revision, recorded on 25 October 2026, CPython 3.13.16 / Linux (not yet repeated for the reduced tests):

  • Exact final timestamp cases on original backend: six Linux failures, 12 non-Linux controls pass. The six are two numeric-offset errors, two misleading warnings and two unnecessary uptime calls.
  • Final 18 timestamp cases pass; full PCAN module 66 tests plus 24 subtests pass, also rerun in the unchanged five-fix refresh. Independent inspection reran the 18 timestamp cases.
  • Historical 18-case tests isolated the backend namespace and exercised platform, frame and uptime combinations. At the maintainer's request, commit 30a12c6 reduces these to three focused cases: Linux classic CAN, Linux CAN FD and non-Linux classic CAN, all with uptime available. The three tests assert only the timestamp clock-domain behavior; native event handles remain disabled.
  • Configured lint, five static mypy targets and strict Sphinx HTML/doctests pass. PCAN/tests are excluded from project mypy coverage; static version targets are not executed runtime matrices.
  • Full suite: 521 passed, 29 passing subtests, 98 skipped, 28 failed. All 28 failure identities equal the unchanged-base multicast IPv4/IPv6 initialization failures, errno 19. The all-tests checkbox remains unchecked.

On 27 October, historical head 6bf8c074a6ba919d5c9b5833c9386be74c479690, tree d5825a6c0228039dff16561b4178409eea9fb114, was restored from clean tested 19b565f877c76fbc2853aa3dc2814b0b1dd4b399. The newer test-only change in 30a12c6 was not executed locally; the reduced tests are now covered by the successful hosted CI run below.

No physical PCAN adapter/driver execution, SocketCAN vcan or hardware clock behaviour on Windows/macOS is claimed. The full hosted OS/interpreter matrix passed for the current head; these are software CI results, not physical CAN-adapter validation.

Prepared with AI assistance and independent inspection.

Timothy Anderson — Spotted Ridge Engineering / OC Labs
Independent software verification · GDN (Global Decision Network)
timothyanderson096@gmail.com · Engineering evidence

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T00:28:13.525446Z
We couldn’t complete this review. Comment @codex review to try again.
6bf8c07 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@timothyanderson096-ocdealcheck

Copy link
Copy Markdown
Contributor Author

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zariiii9003

Copy link
Copy Markdown
Collaborator

test_timestamp_clock adds 18 cases and about 120 lines for a 10-line fix. Re-running the module with patched platform flags is a reasonable way to test a choice made at import time. However, most of the test checks behaviour that does not depend on this change: payload, DLC, FD and BRS flags, and timestamp rollover arithmetic, which are already covered by existing tests. Some assertions also check internal details (whether uptime.boottime() was called). Every additional case and assertion must be maintained when pcan.py changes. I suggest keeping:

@zariiii9003

Copy link
Copy Markdown
Collaborator

there's a conflict

@zariiii9003 zariiii9003 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@zariiii9003
zariiii9003 merged commit a82d020 into hardbyte:main Nov 23, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PcanBus adds boottimeEpoch to PCAN-Basic timestamps that are already UTC epoch on Linux

2 participants