2 #include <MelLibType.h>
5 #elif defined( MEL_IOS ) || defined( MEL_MACOSX )
6 #include <mach/mach_time.h>
7 #elif defined( MEL_LINUX ) || defined( MEL_ANDROID )
42 inline uint64_t getMilliseconds()
const;
46 inline uint64_t getLastMilliseconds()
const;
47 inline bool getPaused()
const;
51 inline uint64_t getStartTime()
const;
52 inline void setStartTime( uint64_t );
60 mutable uint64_t mLastTime;
61 #elif defined( MEL_IOS ) || defined( MEL_MACOSX )
62 mach_timebase_info_data_t mTimeBase;
63 mutable uint64_t mLastTime;
64 #elif defined( MEL_LINUX ) || defined( MEL_ANDROID )
65 mutable uint64_t mLastTime;
78 if ( mState == ACTIVE )
82 QueryPerformanceCounter( (LARGE_INTEGER*)&tmp );
83 result = ( tmp - mReference ) * 1000 /
85 #elif defined( MEL_IOS ) || defined( MEL_MACOSX )
86 uint64_t tmp = mach_absolute_time();
87 uint64_t elapsed = tmp - mReference;
88 result = ( elapsed * mTimeBase.numer ) / mTimeBase.denom;
89 #elif defined( MEL_LINUX ) || defined( MEL_ANDROID )
92 int chk( clock_gettime( CLOCK_MONOTONIC, &ts ) );
95 tmp = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
96 result = tmp - mReference;
104 mLastTime = result + mMsActive + mStartTime;
112 return (
unsigned long)mLastTime;
114 bool Timer::getPaused()
const {
return mState == PAUSED; }
116 void Timer::setStartTime( uint64_t v ) { mStartTime = v; }
uint64_t getLastMilliseconds() const
Definition: Timer.h:107
uint64_t getMilliseconds() const
Definition: Timer.h:75
uint64_t getStartTime() const
Definition: Timer.h:115
Definition: Callback_Impl.h:11