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.

.