Time::HiRes usleep on windows strange behaviour...please please help!!



Hi,

I had asked a question recently and received a pointer to the problem
(thanks Xho). So i've basically found what the culprit is but now i
don't know what i can do to get around it.
Basically i run activestate perl v.5.8 on windows.
The heart of my script relies on the user being able to alter the sleep
time in a loop by at least milliseconds but preferably by microseconds.
What i have discovered is strange.
If i use usleep (for microsecond granularity) or win32::sleep (for
millisecond granualarity) they both produce weird actual sleep times
based on what value is supplied to them. Here is an example with
usleep:

Any value between 1 - 999 microseconds actually only sleep for 10
microseconds.
Any value between 1000 - 10990 microseconds actually sleeps for 10000
microseconds.
Any value between 11000 - 20990 microseconds actually sleeps for 20000
microseconds.

This trend continues, what i dont understand is it cant be the
granularity of usleep because it can sleep for 10 microseconds so does
anyone have any idea why usleep doesn't seem interested in sleeping for
certain values here?
If i use win32::sleep with milliseconds a similar thing happens. I'd
sell a kidney to know this as its driving me crazy!!!
The worst thing is i've spent weeks writing a fairly large script and
i'm panicking now as it is useless without the abilty to control the
loop execution rate.

.



Relevant Pages

  • Re: new here - wget ./configure
    ... Parsing authenticationMethod=simple ... stop: sleep 100000 microseconds ... restart: sleep 100000 microseconds ...
    (comp.sys.sun.admin)
  • a zone as ldapclient
    ... but without success within a solaris 10 zone this time. ... Parsing authenticationMethod=simple ... stop: sleep 100000 microseconds ...
    (comp.unix.solaris)
  • Re: Sun Solaris 10 - AD integration
    ... I need to overcome is with the ldapclient. ... stop: sleep 100000 microseconds ...
    (comp.unix.solaris)
  • Solaris ldap client problem (tls:simple + anonymous)
    ... but I have a problem regarding connecting Solaris 10 ldap client to it ... Both SSL with proxy credential level or anonymous without SSL work ... stop: sleep 100000 microseconds ...
    (comp.unix.solaris)
  • Re: time in us in OnTimer
    ... Windows is completely inappropriate for this purpose. ... you cannot use a general-purpose operating system. ... accuracy of more than a few hundred milliseconds under normal conditions, ... I have, next to my desk, a mass spectrometer that samples every 27 microseconds. ...
    (microsoft.public.vc.mfc)