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:
@@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user