UPDATE Try this to see what is happening:
sub sleepy { my $count = shift; my $time = gettimeofday; sleep(0.0001); # Sleep here to ensure unique time my $hitime = gettimeofday; print $time - $hitime,' '; if ( $time == $hitime ) { $match++; } }

I think you are running into some real world factors affecting computers(desktops/laptops). Although we all like to assume that our little machines maintain atomic clock, laboratory quality, time; it's not true. A computer has a little imperfect crystal, that maintains it's time. The crystal is not even temperature stabilized, meaning your clock rate varies with temperature. It's not enough for us to notice, unless there is a bad failure, and the computer circuitry is designed to work with the variations, by using edges of clock waves for synchronization.

You also have the kernel's design to consider. There are different schedulers, and the one you would want to use would be the low-latency kernel, that audiophiles use. Otherwise, your kernel may decide to spend a few microseconds updating your display, rather than process your script.

Our computers seem like superfast machines to us, but in a true measure of time, they slog along like they were mired in molasses.


I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: Time::HiRes sleep does not always work by zentara
in thread Time::HiRes sleep does not always work by tone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.