a counter as timer which has states start, stop, is expired
++ // C++ class Counter { private: int _startTime; int _stopTime; public: void start() { _startTime = time(NULL); } void stop() { _stopTime = time(NULL); } bool isExpired(int duration) { return _stopTime - _startTime > duration; } }