Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-20 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found