2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2012-09-23 17:23:33 -04:00
|
|
|
#include "Timer.h"
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-30 04:06:41 -04:00
|
|
|
cTimer::cTimer(void)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2013-08-30 04:06:41 -04:00
|
|
|
#ifdef _WIN32
|
|
|
|
QueryPerformanceFrequency(&m_TicksPerSecond);
|
|
|
|
#endif
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2013-08-30 04:06:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long long cTimer::GetNowTime(void)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2013-08-30 04:06:41 -04:00
|
|
|
#ifdef _WIN32
|
|
|
|
LARGE_INTEGER now;
|
|
|
|
QueryPerformanceCounter(&now);
|
|
|
|
return ((now.QuadPart * 1000) / m_TicksPerSecond.QuadPart);
|
|
|
|
#else
|
|
|
|
struct timeval now;
|
|
|
|
gettimeofday(&now, NULL);
|
|
|
|
return (long long)(now.tv_sec * 1000 + now.tv_usec / 1000);
|
|
|
|
#endif
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2013-08-30 04:06:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|