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
void wxStopWatch::Start(long t)
{
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;
m_t0 = wxGetLocalTimeMillis() - t;
m_pause = 0;
m_pauseCount = 0;
}
long wxStopWatch::GetElapsedTime() const
{
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();
return (wxGetLocalTimeMillis() - m_t0).GetLo();
}
long wxStopWatch::Time() const
}
long wxStopWatch::Time() const