Problem
SlidingWindow exposes a private monotonic_seconds helper that converts @clock.monotonic_time (ms) to seconds:
def monotonic_seconds
@clock.monotonic_time / 1000.0
end
The ms→s division is a unit-conversion concern that belongs on the clock, not on every caller. monotonic_time also has an ambiguous name — the unit is not apparent from the method name.
Proposed change
- Add
monotonic_seconds to the clock interface (SystemClock, NullClock) returning Float seconds via Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second)
- Rename
monotonic_time → monotonic_millis to make the unit explicit
- Update
SlidingWindow to call @clock.monotonic_seconds directly, removing its own conversion helper
- Update RBS signatures for both clock types and
SlidingWindow
Acceptance criteria
SystemClock#monotonic_seconds returns float seconds
SystemClock#monotonic_millis replaces monotonic_time
NullClock exposes both methods
SlidingWindow removes its private conversion helper and calls @clock.monotonic_seconds
- RBS updated throughout
system_clock_spec covers both new methods
Problem
SlidingWindowexposes a privatemonotonic_secondshelper that converts@clock.monotonic_time(ms) to seconds:The ms→s division is a unit-conversion concern that belongs on the clock, not on every caller.
monotonic_timealso has an ambiguous name — the unit is not apparent from the method name.Proposed change
monotonic_secondsto the clock interface (SystemClock,NullClock) returningFloatseconds viaProcess.clock_gettime(Process::CLOCK_MONOTONIC, :float_second)monotonic_time→monotonic_millisto make the unit explicitSlidingWindowto call@clock.monotonic_secondsdirectly, removing its own conversion helperSlidingWindowAcceptance criteria
SystemClock#monotonic_secondsreturns float secondsSystemClock#monotonic_millisreplacesmonotonic_timeNullClockexposes both methodsSlidingWindowremoves its private conversion helper and calls@clock.monotonic_secondssystem_clock_speccovers both new methods