#ifndef TIMER_H_45E2F1F9 #define TIMER_H_45E2F1F9 class Timer { public: Timer(int dt) : dt_(dt) {} void accumulate(int t) { acc_ += t; } bool step() { if (acc_ > dt_) { acc_ -= dt_; return true; } else { return false; } } void reset() { acc_ = 0; } int getDt() const { return dt_; } private: int dt_; int acc_ = 0; }; #endif /* end of include guard: TIMER_H_45E2F1F9 */