Skip to content

v0.1.10 - Time Synchronization Features (2025-12-02)

What Changed?

This release adds device time synchronization capabilities through a new time() method in the Command class. The listen command now automatically sets the device time to the current PC time at startup, which is essential for devices without RTC (real-time clock). Time synchronization includes proper error handling to ensure the listening process continues even if time setting fails.


What's New

Main Feature: Device Time Synchronization

What it does: The new time() method in the Command class provides bidirectional time handling: retrieving the current device time with GET_TIME or setting device time with SET_TIME. The listen command automatically synchronizes device time at startup without requiring manual intervention.

How to use it:

# Automatic time sync when listening (no action needed)
kazunoko listen -c 100

# Manual time operations via Python API
import time
from kazunoko import connect, Command

with connect() as device:
    cmd = Command(device)

    # Get device time
    resp = cmd.time()
    print(resp.timestamp)

    # Set device time to current PC time
    resp = cmd.time(int(time.time()))

Code example:

import time
cmd = Command(device)

# Automatic in listen command - sets time at startup
# Manual usage for API users
unixtime = int(time.time())
response = cmd.time(unixtime)
print(response.status)  # "ok"

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

  • New time() method in Command class for GET_TIME/SET_TIME commands
  • Automatic device time synchronization in listen command at startup
  • Time synchronization error handling with graceful fallback

🔧 Changed

  • listen command now sets device time automatically (transparent to user)

🐛 Fixed

  • Devices without RTC now properly synchronized at data collection startup

Is It Safe to Upgrade?

Backward Compatible: Yes

  • No breaking changes to existing APIs
  • New time() method is additive only
  • listen command enhancement is transparent (no parameter changes)
  • Time synchronization failures don't interrupt event listening

Tests Passed

  • ✅ Builds without errors
  • ✅ Linting (ruff check)
  • ✅ Type checking (mypy)
  • ✅ Device time synchronization with mock device
  • listen command continues when time sync fails

Release Details

  • Date: 2025-12-02
  • Version: v0.1.10
  • Files Changed: 2 (src/kazunoko/command.py, src/kazunoko/cli.py)
  • Commits:
  • 1f5aa31 - feat(command): add time method for GET_TIME/SET_TIME commands
  • 87bf99e - feat(cli): add device time synchronization in listen command
  • d8a6c33 - bump: version 0.1.9 → 0.1.10

Next Steps

Consider adding:

  • Optional time synchronization flag for listen command (to disable if needed)
  • Time validation and range checking
  • Device time diagnostics command to check time offset