[Tutor] better resolution on time.sleep()?

Roger Merchberger zmerch at 30below.com
Tue May 24 07:52:04 CEST 2005


Rumor has it that Roger Merchberger may have mentioned these words:

Yea, yea, I'm replying my own message.... you'll see why later! ;-)

>Rumor has it that jfouhy at paradise.net.nz may have mentioned these words:

> >I just did some experimenting ... I am running ActiveState Python 2.4.1 
> under
> >Windows XP / cygwin.
>
>I'm running under Linux From Scratch, book 4.0, kernel 2.4.29.

I downloaded and compiled Python 2.4.1 this evening, and the granularity of 
sleep hasn't changed on my system... maybe it's a kernel limitation? Hrm...

Despite my pitiful C knowledge, I found a code snippet I modified to make a 
command-line "msleep" command which sleeps for 1 millisecond & exits, and 
called that with an os.system('msleep') call. The best I could get then is 
around 32 samples for second, so that seemed "marginally less efficient" 
calling my msleep command thru the OS compared to the "realtime usleep" 
function I downloaded earlier to run on Python 2.2.2. The realtime package 
wouldn't compile with Python 2.4.1 (not that it did me much good before... ;-).

=-=-=

I'm downloading the source to wxPython now, there is a wx.usleep function 
in there. As I mentioned, it seems a bit'o'overkill to me, but what the 
heck, in for a penny, in for a pound, eh? ;^>

I'll let y'all know how it turns out...

Laterz,
Roger "Merch" Merchberger

--
Roger "Merch" Merchberger   | Anarchy doesn't scale well. -- Me
zmerch at 30below.com.         |
SysAdmin, Iceberg Computers



More information about the Tutor mailing list