Changed: Simplify more
This commit is contained in:
parent
6404f8eafa
commit
555336bbea
2 changed files with 21 additions and 32 deletions
|
@ -84,16 +84,10 @@ public:
|
|||
* the value can jump backwards if the system time is changed by a user or a NTP time sync process.
|
||||
* The value is different on 2 different computers; use the CUniTime class to get a universal
|
||||
* time that is the same on all computers.
|
||||
* \warning On Win32, the value is on 32 bits only, and uses the low-res timer. It wraps around to 0 every about 49.71 days.
|
||||
* \warning On Win32, the value is on 32 bits only, and uses the low-res timer unless probeTimerInfo was called and a high resolution timer can be used. It wraps around to 0 every about 49.71 days.
|
||||
*/
|
||||
static TTime getLocalTime();
|
||||
|
||||
/** Same as getLocalTime, but prefers high resolution timers.
|
||||
* Must call probe once in the beginning of the application before using,
|
||||
* to ensure the correct settings are applied.
|
||||
*/
|
||||
static TTime getLocalTimeHR();
|
||||
|
||||
/** 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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue