Added wxStopWatch::TimeInMicro() for better precision time measurement.
Also simplify/streamline wxStopWatch implementation and replace confusingly named m_pause with more clear m_elapsedBeforePause. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -55,13 +55,22 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( StopWatchTestCase, "StopWatchTestCase" );
|
||||
|
||||
void StopWatchTestCase::Misc()
|
||||
{
|
||||
static const long tolerance = 100; // in ms
|
||||
static const long tolerance = 10; // in ms
|
||||
|
||||
wxStopWatch sw;
|
||||
long t;
|
||||
wxLongLong usec;
|
||||
|
||||
sw.Pause(); // pause it immediately
|
||||
|
||||
// verify that almost no time elapsed
|
||||
usec = sw.TimeInMicro();
|
||||
WX_ASSERT_MESSAGE
|
||||
(
|
||||
("Elapsed time was %" wxLongLongFmtSpec "dus", usec),
|
||||
usec < tolerance*1000
|
||||
);
|
||||
|
||||
wxSleep(1);
|
||||
t = sw.Time();
|
||||
|
||||
|
Reference in New Issue
Block a user