Skip to content

v0.1.35 - Timestamp Precision Enhancement (2025-12-13)

What Changed?

This release improves timestamp precision for device responses by changing the received_us field from seconds to microseconds. The type annotation has also been updated from float to int for accuracy. This enables higher-precision timing analysis and event correlation without changing the public API.


What's New

Enhancement: Microsecond Timestamp Precision

What it does: The received_us field in device responses now uses microsecond precision instead of second precision. This field records when a response/event was received by the library.

Why it matters:

  • Higher precision enables accurate event timing correlation
  • Useful for performance analysis and latency measurement
  • Type annotation (int instead of float) provides better type safety
  • No API changesβ€”users can seamlessly use the higher-precision values

Technical details:

Changed from:

received_us: float | None = None  # seconds since epoch

To:

received_us: int | None = None  # microseconds since epoch

The timestamp is calculated as int(time.time() * 1_000_000) in both PortDevice and MockDevice.


Installation

Quick Start

# Get the release
git checkout vX.Y.Z

# Setup
task env:setup

# Run CLI
uv run kazunoko --help

What's Different from the Last Version?

βœ… Added

  • None (refactoring/enhancement release)

πŸ”§ Changed

  • DeviceResponse.received_us now uses int type instead of float
  • Timestamp precision changed from seconds to microseconds
  • Both PortDevice and MockDevice now return microsecond timestamps

πŸ› Fixed

  • Type accuracy: int is semantically correct for microsecond timestamps

Is It Safe to Upgrade?

Backward Compatible: Mostly Yes

  • Type change from float to int is compatible for most use cases
  • If code explicitly checks isinstance(response.received_us, float), it will need updating
  • Values are now 1,000,000x larger (seconds to microseconds)
  • All existing functionality remains unchanged

Tests Passed

  • βœ… Builds without errors
  • βœ… Type checking (mypy) - no new errors
  • βœ… Linting (ruff) - all checks passed
  • βœ… Consistent across all modules (device.py, mock.py, parser.py)

Release Details

  • Date: 2025-12-13
  • Version: v0.1.35
  • Files Changed: 3
  • Commits: 48abfcb

Next Steps

  • Continue improving code quality and maintainability
  • Consider adding comprehensive test coverage for timestamp handling
  • Future enhancements may include nanosecond precision if needed