123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #ifndef TIMER_H
- #define TIMER_H
- template <class T>
- class Timer
- {
- public:
- Timer();
- void start();
- void stop(){m_isRunning = false;}
- bool running(){return m_isRunning;}
- bool expired(T msPeriod);
- private:
- bool m_isRunning;
- T m_started;
- };
- #if __cplusplus>=201103L
- using LongTimer = Timer<unsigned long>;
- #else
- typedef Timer<unsigned long> LongTimer;
- #endif
- #if __cplusplus>=201103L
- using ShortTimer = Timer<unsigned short>;
- #else
- typedef Timer<unsigned short> ShortTimer;
- #endif
- #endif
|