From 87798c003078506f901ed659620db1f2c71dfb48 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Mar 2000 02:31:16 +0000 Subject: [PATCH] test for 'backwards clock' bug git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6454 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/console/console.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/samples/console/console.cpp b/samples/console/console.cpp index 56a0493e37..a845e71b01 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -738,17 +738,32 @@ static void TestStopWatch() wxStopWatch sw; printf("Sleeping 3 seconds..."); wxSleep(3); - printf("\telapsed time: %ld\n", sw.Time()); + printf("\telapsed time: %ldms\n", sw.Time()); sw.Pause(); printf("Sleeping 2 more seconds..."); wxSleep(2); - printf("\telapsed time: %ld\n", sw.Time()); + printf("\telapsed time: %ldms\n", sw.Time()); sw.Resume(); printf("And 3 more seconds..."); wxSleep(3); - printf("\telapsed time: %ld\n", sw.Time()); + printf("\telapsed time: %ldms\n", sw.Time()); + + wxStopWatch sw2; + puts("\nChecking for 'backwards clock' bug..."); + for ( size_t n = 0; n < 70; n++ ) + { + sw2.Start(); + if ( sw.Time() < 0 || sw2.Time() < 0 ) + { + puts("\ntime is negative - ERROR!"); + } + + putchar('.'); + } + + puts(", ok."); } #endif // TEST_TIMER -- 2.45.2