in reply to Re^2: NTP Error
in thread NTP Error
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::NTPPOE::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/; 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));
I got mixed results, but if I use my system time, Net::NTP is consistently faster.#!/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 ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: NTP Error
by BrowserUk (Patriarch) on May 30, 2012 at 21:29 UTC |