You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
373 B
22 lines
373 B
#ifndef __TIMER_H_
|
|
#define __TIMER_H_
|
|
|
|
class Timer {
|
|
private:
|
|
unsigned long prev;
|
|
unsigned long current;
|
|
public:
|
|
Timer() {
|
|
current = prev = millis();
|
|
}
|
|
inline void ChkFirst() {
|
|
prev = millis();
|
|
}
|
|
inline void ChkLast() {
|
|
current = millis();
|
|
}
|
|
|
|
unsigned long GetSecond() {return (current - prev) / 1000;}
|
|
};
|
|
|
|
#endif
|