Utils/Rate Counter: return true on first invocation

This commit is contained in:
Charles Dang 2025-03-21 23:36:14 -04:00
parent 3299eea7c6
commit 430584c22b

View File

@ -21,8 +21,8 @@ class rate_counter
public:
explicit rate_counter(unsigned rate) : rate_(rate) {}
/** Increments the counter by one and checks whether it is now a multiple of the chosen rate. */
bool poll() { return (++counter_ % rate_) == 0; }
/** Checks whether the counter is now a multiple of the chosen rate, then increments it by one. */
bool poll() { return (counter_++ % rate_) == 0; }
private:
unsigned counter_ = 0;