This one looks promising. :)

It is less punctual than the original code I posted, but I might do.

But I got something strange when I replaced time() in my original code with gettimeofday: exactly precise seconds (to 5 decimal places). I am not quite sure if that is actually correct–is that just calculated to be precise or it the measurement actually precise? I believe that my measurements are not as precise as yours. :)

I tried to simplify the test using my $w2 = EV::periodic( 0, 1, 0, sub { print gettimeofday, "\n";} );, but the result was quite unprecise; here’s the output:

15748078781259 15748078791348 15748078801032 15748078811008 1574807882999 1574807883541 1574807884744 15748078851030 15748078861002 15748078871099 1574807888937 15748078892034 15748078901001 15748078912030 15748078921019 1574807893339M

Do I do something wrong?

Anyway, I use chrony, too, but my original timer function (from time to time) still complains about negative time not invented yet. Although, I use default settings of CentOS 7 for chrony–do I need to adjust something to use those smooth adjustments?


In reply to Re^4: The most precise second (timer) by tukusejssirs
in thread The most precise second (timer) by tukusejssirs

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.