Skip to content

Amiga tool_now_ms() uses non-monotonic DateStamp; clock changes skew keepalive/retry timing #8

Description

@sidick

Flagged in the pre-release review, deliberately deferred (not a v0.1 blocker; the host build was fixed to use CLOCK_MONOTONIC in the same pass).

src/amiga/clock.c's tool_now_ms() is wall-clock (DateStamp), not monotonic. A clock change mid-session (setclock, NTP/TZ correction) jumps all keepalive/PUBACK/SUBACK/backoff arithmetic that depends on it — used by both CLI tools and every mqtt.library child.

Example: clock stepped back 1 minute while a QoS 1 publish waits → the 5s retry window becomes ~65s; stepped forward → instant keepalive timeout and a spurious connection-lost/reconnect.

AmigaOS has no cheap monotonic clock equivalent to CLOCK_MONOTONIC out of the box — worth checking timer.device's TR_GETSYSTIME/UNIT_VBLANK, or accepting the DateStamp-based approach with a documented caveat, before deciding.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtech-debtDeliberately deferred fix or design tradeoff from a past review

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions