Why not take it up a notch by using POE:::Component::Client::NTP. The author of Net::NTP joined forces with Chris Williams, so it's built on top of Net::NTP.
I added some error handling, but the way you're doing time just doesn't work for me. I'm tryimg Time::Stamp at the moment, but I haven't got it working right yet. Here's what I have so far:#!/usr/bin/perl -l use strict; use warnings; use Data::Dumper::Concise; use POE qw(Component::Client::NTP); #use Time::Stamp -stamps => {format => 'easy'}; my $host = shift @ARGV; POE::Session->create( package_states => [ main => [qw(_start _stop _response)], ], ); $poe_kernel->run(); exit 0; sub _start { POE::Component::Client::NTP->get_ntp_response( host => $host, event => '_response', ) or die "Couldn't connect to server: $!"; return; } sub _stop { print "Refcount was decremented"; return; } sub _response { my $packet = $_[ARG0]; print Dumper( $packet ); }
In reply to Re: NTP Error
by Khen1950fx
in thread NTP Error
by saeen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |