Committed currently disabled code that implements

the wxStopWatch based on QueryPerformanceCounter()
   I'll do more testing if I can, but here is the code
   for other to look at.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32083 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2005-02-15 19:50:27 +00:00
parent 8e475be490
commit 2555c77a81

View File

@@ -109,16 +109,50 @@
#if wxUSE_STOPWATCH
void wxStopWatch::Start(long t)
{
#ifdef 0
__WXMSW__
LARGE_INTEGER frequency_li;
::QueryPerformanceFrequency( &frequency_li );
m_frequency = frequency_li.QuadPart;
if (m_frequency == 0)
{
m_t0 = wxGetLocalTimeMillis() - t;
}
else
{
LARGE_INTEGER counter_li;
::QueryPerformanceCounter( &counter_li );
wxLongLong counter = counter_li.QuadPart;
m_t0 = (counter * 10000 / m_frequency) - t*10;
}
#else
m_t0 = wxGetLocalTimeMillis() - t;
#endif
m_pause = 0;
m_pauseCount = 0;
}
long wxStopWatch::GetElapsedTime() const
{
#ifdef 0
__WXMSW__
if (m_frequency == 0)
{
return (wxGetLocalTimeMillis() - m_t0).GetLo();
}
else
{
LARGE_INTEGER counter_li;
::QueryPerformanceCounter( &counter_li );
wxLongLong counter = counter_li.QuadPart;
wxLongLong res = (counter * 10000 / m_frequency) - m_t0;
return res.GetLo() / 10;
}
#else
return (wxGetLocalTimeMillis() - m_t0).GetLo();
#endif
}
long wxStopWatch::Time() const
{