• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hardbyte / python-can / 22640831152 / 17
71%
main: 71%

Build:
DEFAULT BRANCH: main
Ran 03 Mar 2026 08:21PM UTC
Files 91
Run time 4s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Mar 2026 08:16PM UTC coverage: 66.031% (+0.03%) from 66.006%
22640831152.17

push

github

web-flow
Fix/asc writer timestamps format (#2032)

* feat(asc): add timestamps_format parameter to ASCWriter

Allow callers to choose between 'absolute' (default, existing behaviour)
and 'relative' when creating an ASC log file. The value is written into
the 'base hex  timestamps ...' header line so that other tools
(CANalyzer, CANoe, etc.) can interpret the file correctly.

Closes #2022

* docs: add changelog fragment for #2022

* style: apply black formatting to logformats_test.py

* fix(asc): apply timestamps_format to actual written timestamps, not just header

Previously, log_event() always subtracted self.started from every timestamp
regardless of timestamps_format, meaning "relative" mode only changed the
header line while writing identical data to "absolute" mode.

Per the ASC format specification:
- "absolute": each timestamp is an offset from the start of measurement
- "relative": each timestamp is a delta from the preceding event

Fix log_event() to compute per-event deltas when timestamps_format="relative",
and update self.last_timestamp after each event so the next delta is correct.

Also add two tests that verify the actual values written to the file differ
between the two modes (3-message uneven spacing exposes the distinction at msg3:
absolute writes 1.0, relative writes 0.7).

Update changelog fragment to describe the semantic difference accurately.

* fix(asc): address PR review feedback on timestamps_format

Reviewer feedback received (zariiii9003):

1. Use Literal type hint for timestamps_format parameter
   - Changed: timestamps_format: str = "absolute"
   - To:      timestamps_format: Literal["absolute", "relative"] = "absolute"
   - Added Literal to typing imports

2. Simplify log_event timestamp computation
   - Moved monotonic clamp out of if/else blocks:
     timestamp = max(timestamp, self.last_timestamp)
   - Each branch now contains only simple arithmetic:
     absolute: written_timestamp = timestamp - self.started
     relative: w... (continued)

7198 of 10901 relevant lines covered (66.03%)

0.66 hits per line

Source Files on job Unittests-ubuntu-latest-py312 - 22640831152.17
  • Tree
  • List 91
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 22640831152
  • 59b2e435 on github
  • Prev Job for on main (#22527804257.20)
  • Next Job for on main (#22642051689.9)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc