mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-25 16:46:17 +00:00
Changed: Simplify some things
This commit is contained in:
parent
e46a301ad0
commit
d0de6deddc
2 changed files with 5 additions and 17 deletions
|
@ -84,7 +84,7 @@ 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. 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. It wraps around to 0 every about 49.71 days.
|
||||
*/
|
||||
static TTime getLocalTime();
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace NLMISC
|
|||
namespace {
|
||||
#ifdef NL_OS_WINDOWS
|
||||
bool a_HaveQueryPerformance = false;
|
||||
LARGE_INTEGER a_QueryPerformanceFrequency;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -72,6 +73,7 @@ void CTime::probeTimerInfo(CTime::CTimerInfo &result)
|
|||
result.HighPrecisionResolution = 1000;
|
||||
}
|
||||
a_HaveQueryPerformance = result.IsHighPrecisionAvailable;
|
||||
a_QueryPerformanceFrequency.QuadPart = winPerfFreq.QuadPart;
|
||||
if (!result.IsHighPrecisionAvailable)
|
||||
{
|
||||
lowResTime = timeGetTime();
|
||||
|
@ -299,20 +301,6 @@ TTime CTime::getLocalTime ()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
namespace {
|
||||
struct CQPFProvider
|
||||
{
|
||||
CQPFProvider()
|
||||
{
|
||||
QueryPerformanceFrequency(&Frequency);
|
||||
}
|
||||
LARGE_INTEGER Frequency;
|
||||
};
|
||||
CQPFProvider s_QPFProvider;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Same as above but prefer high resolution timer
|
||||
TTime CTime::getLocalTimeHR()
|
||||
{
|
||||
|
@ -323,8 +311,8 @@ TTime CTime::getLocalTimeHR()
|
|||
// If my calculations are right.
|
||||
LARGE_INTEGER counter;
|
||||
QueryPerformanceCounter(&counter);
|
||||
counter.QuadPart *= 1000;
|
||||
counter.QuadPart /= s_QPFProvider.Frequency.QuadPart;
|
||||
counter.QuadPart *= (LONGLONG)1000L;
|
||||
counter.QuadPart /= a_QueryPerformanceFrequency.QuadPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue