Glad to see that you're feeling chipper! I like your MAC analogy; however, I'd choose a MAC over a shopping trolley any time:-).

I recommended POE::Component::Client::NTP because it's a better fit with my system, and because it doesn't look for Socket6---it fails tests for me. To get around that, I started using POE::Component::Client::NTP.

As for which one is the closest to spot-on, I ran some simple timing tests. Hmmm...the jury is still out on that one.

Net::NTP
#!/usr/bin/perl use strict; use warnings; use Time::AutoRes qw/time/; use Data::Dumper::Concise; use Net::NTP qw/get_ntp_response/; my $host = 'pool.ntp.org'; print Dumper(my $start = time); my %response = get_ntp_response($host); print Dumper( %response ), "\n"; print Dumper(my $end = time); print Dumper(my $elapsed_time = ($end - $start));
POE::Component::Client::NTP
#!/usr/bin/perl use strict; use warnings; use Time::AutoRes qw/time/; use Data::Dumper::Concise; use Net::NTP qw/get_ntp_response/; use POE qw/Component::Client::NTP/; my $host = 'pool.ntp.org'; print Dumper(my $start = time); POE::Session->create( package_states => [ main => [qw(_start _stop _response)], ], ); $poe_kernel->run(); print Dumper(my $end = time); print Dumper(my $elapsed_time = ($end - $start)); exit 0; sub _start { POE::Component::Client::NTP->get_ntp_response( host => $host, event => '_response', context => 'word', ) or die "Couldn't connect to server: $!"; return; } sub _stop { print "Refcount was decremented"; } sub _response { my $packet = $_[ARG0]; print Dumper( $packet ); }
I got mixed results, but if I use my system time, Net::NTP is consistently faster.

In reply to Re^3: NTP Error by Khen1950fx
in thread NTP Error by saeen

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.