Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: The most precise second (timer)

by tukusejssirs (Beadle)
on Nov 26, 2019 at 16:16 UTC ( [id://11109275]=note: print w/replies, xml ) Need Help??


in reply to Re: The most precise second (timer)
in thread The most precise second (timer)

Here you go. This is even worse.

$ time perl -MTime::HiRes=sleep -E 'say sleep 1' 1.000147 real 0m1.139s user 0m0.006s sys 0m0.008s

Replies are listed 'Best First'.
Re^3: The most precise second (timer)
by duelafn (Parson) on Nov 27, 2019 at 10:24 UTC

    You miss the point of this test. Anonymous Monk's point is not to suggest calling out to an external perl. The point is that sleep() itself has inherently imprecise. You requested sleep(1) but actually got 1.000147 seconds of sleep. Therefore fussing over 0.00000XXXX seconds of "error" is futile.

    Good Day,
        Dean

      Therefore fussing over 0.00000XXXX seconds of "error" is futile.

      Yes, but the error is cumulative: 1.000147 seconds of sleep over one day amounts to an error of about 12 seconds, which might be worth fussing over...

        The error is not cumulative in the OP code nor most of the suggestions.

        Good Day,
            Dean

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11109275]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2025-12-07 13:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (85 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.