Skip to content

Use a monotonic clock for auto-stop, runaway guard, and runtime #52

Closed

Description

@TMHSDigital

Summary

The engine measures auto-stop, the runaway-CPS window, and runtime with time.time() (the wall clock). An NTP sync, a manual clock change, or a DST/timezone change during a session can:

  • trigger auto-stop early (clock jumps forward) or never (clock jumps back),
  • distort the 1-second runaway window (false trips or a blind spot),
  • show a negative or jumping runtime.

Evidence

autoclicker/core/click_engine.py:142 (start_time), :192, :360-363 (runaway window), :392 (auto-stop), :493 (click timestamps), :544 (runtime).

Suggested approach

Use time.monotonic() for all durations and intervals. Keep time.time() only where a wall-clock timestamp is displayed or logged. Update tests that patch time.time.

Done when

No elapsed-time logic depends on time.time(), and a test that patches monotonic verifies auto-stop is unaffected by a wall-clock jump.

Activity

  1. added
    bug
    priority: low
    safety
    on Oct 4, 2026
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

    bugpriority: lowsafety

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions