On Tue, 30 Jan 2001 04:13:39 -0500, Michael G Schwern wrote:

>Is there any really good reason why sleep() doesn't work for
>microseconds?  I mean, if I can do this:
>
>    sub sleep {
>        my($time) = shift;
>        if( /^[+-]?\d+$/ ) {
>            sleep($time);
>        }
>        else {
>            select(undef, undef, undef, $time);
>        }
>    }
>
>Why can't Perl?

One of your problems is that sleep(3) is NOT garanteed to sleep exactly
3 full seconds. It's only garanteed that the difference between time()
before, and after, will be (at least) 3. So sleep 3 actually just has to
wait for 3 time second rollovers. That may take for example only 2.5
seconds.

Well, that's how it *used* to be. Maybe perl's behaviour has been
changed since then.

If you expect sleep(2.5) to work properly, then sleep(3) should be
fixed, too.

-- 
        Bart.

Reply via email to