#pragma once
// elapsed_at_least — the ONE "has at least this long passed" test behind every
// GetTickCount()-style throttle gate (panel_input's detect cadence, panel_drag's tooltip
// delay). Unsigned subtraction is the deliberate implementation, not an oversight: it is
// exactly correct across a GetTickCount() wraparound (~49.7 days uptime) because `now -
// since`, computed mod 2^32, IS the true forward millisecond distance even when `now`'s
// raw value is numerically less than `since`'s. A signed or `now < since` guard would
// instead wedge the gate shut for up to the wrap period.

namespace reasampler::util {

// True once at least `interval` ms separate `since` from `now` (both GetTickCount()-style
// millisecond counters). `since == 0, interval == 0` reads true, so a zero-initialized
// "last fired" tick opens the gate on its very first call.
inline bool elapsedAtLeast(unsigned int now, unsigned int since, unsigned int interval) {
    return now - since >= interval;
}

}  // namespace reasampler::util
