|
|
|
@ -242,9 +242,28 @@ TTime CTime::getLocalTime ()
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// This is not affected by system time changes. But it cycles every 49 days.
|
|
|
|
|
return timeGetTime();
|
|
|
|
|
// return timeGetTime(); // Only this was left active before it was commented.
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The above is no longer relevant.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (a_HaveQueryPerformance)
|
|
|
|
|
{
|
|
|
|
|
// On a (fast) 15MHz timer this rolls over after 7000 days.
|
|
|
|
|
// If my calculations are right.
|
|
|
|
|
LARGE_INTEGER counter;
|
|
|
|
|
QueryPerformanceCounter(&counter);
|
|
|
|
|
counter.QuadPart *= (LONGLONG)1000L;
|
|
|
|
|
counter.QuadPart /= a_QueryPerformanceFrequency.QuadPart;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Use default reliable low resolution timer.
|
|
|
|
|
return getLocalTime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#elif defined (NL_OS_UNIX)
|
|
|
|
|
|
|
|
|
|
static bool initdone = false;
|
|
|
|
@ -301,30 +320,6 @@ TTime CTime::getLocalTime ()
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Same as above but prefer high resolution timer
|
|
|
|
|
TTime CTime::getLocalTimeHR()
|
|
|
|
|
{
|
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
|
if (a_HaveQueryPerformance)
|
|
|
|
|
{
|
|
|
|
|
// On a (fast) 15MHz timer this rolls over after 7000 days.
|
|
|
|
|
// If my calculations are right.
|
|
|
|
|
LARGE_INTEGER counter;
|
|
|
|
|
QueryPerformanceCounter(&counter);
|
|
|
|
|
counter.QuadPart *= (LONGLONG)1000L;
|
|
|
|
|
counter.QuadPart /= a_QueryPerformanceFrequency.QuadPart;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Use default reliable low resolution timer.
|
|
|
|
|
return getLocalTime();
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
// Other OS always use the best available high resolution timer.
|
|
|
|
|
return getLocalTime();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the time in processor ticks. Use it for profile purpose.
|
|
|
|
|
* If the performance time is not supported on this hardware, it returns 0.
|
|
|
|
|
* \warning On a multiprocessor system, the value returned by each processor may
|
|
|
|
|