Article View: borland.public.cppbuilder.nativeapi
Article #11177Re: Sleep time resolution
From: Rob
Date: Thu, 19 Feb 2004 10:24
Date: Thu, 19 Feb 2004 10:24
26 lines
2255 bytes
2255 bytes
"Detlef" <detlef.stute@seatec-gmbh.com> wrote in message news:4030d231$1@newsgroups.borland.com... > Hi Rob, > the problem with Sleep( 1) on Microsoft Windows systems is, that the minimum > sleep time is a time slice ( and that is 10/15 ms, depending on the > processor type). On my current tests ( which I think are different from my > test years before) I recognized that a sleep bet 1 and 15 causes in real > sleeptimes of 15 - 18 ms, sleeps between 16 and 20 causes in real times of > around 32 ms. I'm not sure of the numbers, but have certainly noted that Sleep() often sleeps longer than intended for small values. The basic issue is that windows is not a hard realtime system and Sleep(n) really only guarantees a sleep time that is at least n milliseconds. > That is the reason for looking another type of a sleep function. As others have said in this thread, you probably want to look at multimedia timers. http://www.torry.net/timers.htm lists various timer components for Delphi that you can either use or, if they include source, you can use as a guide for your specific application. There are other approaches (eg using the actual PC timer), but those require development of a device driver under windows NT/2000/XP.
Technical Details
Message-ID:
<4034913b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<402b4f78$1@newsgroups.borland.com> <402b6ed2$1@newsgroups.borland.com> <402d421b@newsgroups.borland.com> <4030d231$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,3e6954a6a5dc7821 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-19 02:39:25 PST From: "Rob" <nospam@nonexistant.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <402b4f78$1@newsgroups.borland.com> <402b6ed2$1@newsgroups.borland.com> <402d421b@newsgroups.borland.com> <4030d231$1@newsgroups.borland.com> Subject: Re: Sleep time resolution Date: Thu, 19 Feb 2004 20:54:17 +1030 Lines: 30 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4922.1500 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 NNTP-Posting-Host: 211.26.118.18 Message-ID: <4034913b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077186875 211.26.118.18 (19 Feb 2004 02:34:35 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail