From 7f19fc8cae9c4eced886d3680dab7a48476f1c1e Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 8 Aug 2002 10:04:13 +0000 Subject: [PATCH] Applied patch [ 584057 ] Fixes calculation bug in wxThread::Sleep There's a problem in src/mac/thread.cpp function wxThread::Sleep when CLOCKS_PER_SEC is not 1000. The amount-to-sleep code doesn't take into account this value. Due to this when I did Sleep(1000) it was sleeping a fraction of a second because on my Mac CLOCKS_PER_SEC is 60. This patch fixes it. Dimitri Schoolwerth (dimitrishortcut) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/thread.cpp | 10 +++++----- src/mac/thread.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mac/carbon/thread.cpp b/src/mac/carbon/thread.cpp index 5ea6f21f32..474b92a22f 100644 --- a/src/mac/carbon/thread.cpp +++ b/src/mac/carbon/thread.cpp @@ -523,11 +523,11 @@ void wxThread::Yield() void wxThread::Sleep(unsigned long milliseconds) { - clock_t start = clock() ; - do - { - YieldToAnyThread() ; - } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ; + clock_t start = clock(); + do + { + YieldToAnyThread(); + } while( clock() - start < (milliseconds * CLOCKS_PER_SEC) / 1000 ) ; } int wxThread::GetCPUCount() diff --git a/src/mac/thread.cpp b/src/mac/thread.cpp index 5ea6f21f32..474b92a22f 100644 --- a/src/mac/thread.cpp +++ b/src/mac/thread.cpp @@ -523,11 +523,11 @@ void wxThread::Yield() void wxThread::Sleep(unsigned long milliseconds) { - clock_t start = clock() ; - do - { - YieldToAnyThread() ; - } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ; + clock_t start = clock(); + do + { + YieldToAnyThread(); + } while( clock() - start < (milliseconds * CLOCKS_PER_SEC) / 1000 ) ; } int wxThread::GetCPUCount() -- 2.47.2