21 #ifndef GRT_TIMER_HEADER
22 #define GRT_TIMER_HEADER
24 #include "../Util/GRTVersionInfo.h"
27 #if defined(__GRT_WINDOWS_BUILD__)
32 #if defined(__GRT_OSX_BUILD__)
36 #if defined(__GRT_LINUX_BUILD__)
62 timerMode = NORMAL_MODE;
73 bool start(
unsigned long countDownTime){
74 if( countDownTime > 0 ){
77 timerMode = COUNTDOWN_MODE;
78 this->countDownTime = countDownTime;
101 if( !timerRunning )
return 0;
107 return (now-startTime);
110 return (countDownTime - (now-startTime));
129 if( !timerRunning )
return 0;
166 #ifdef __GRT_OSX_BUILD__
168 gettimeofday( &now, NULL );
169 return now.tv_usec/1000 + now.tv_sec*1000;
171 #ifdef __GRT_WINDOWS_BUILD__
172 SYSTEMTIME systemTime;
173 GetSystemTime(&systemTime);
174 return (systemTime.wHour*60*60*1000) + (systemTime.wMinute*60*1000) + (systemTime.wSecond*1000) + systemTime.wMilliseconds;
176 #ifdef __GRT_LINUX_BUILD__
178 gettimeofday( &now, NULL );
179 return now.tv_usec/1000 + now.tv_sec*1000;
185 unsigned long startTime;
186 unsigned long countDownTime;
187 unsigned int timerMode;
190 enum TimerModes{NORMAL_MODE=0,COUNTDOWN_MODE};
197 #endif //GRT_TIMER_HEADER
static unsigned long getSystemTime()
double getSeconds() const
bool start(unsigned long countDownTime)
bool getTimerReached() const
signed long getMilliSeconds() const
bool timerReached() const