Subject: | get_ntp_response - No such host is known |
I get the same result for any time server on MS Windows XP.
A short code file is attached.
I have strawberry Perl v5.20.0 built for MSWin32-x86-multi-thread-64int
Results:
Perl v5.20.0 built for MSWin32-x86-multi-thread-64int
Trying time server pool.ntp.org
Time server pool.ntp.org did not work
IO::Socket::INET6: getaddrinfo: No such host is known. at C:/Perl/perl/site/lib/Net/NTP.pm line 148.
Subject: | ntp_testing_simple.pl |
# File: ntp_testing_simple.pl
use 5.14.2;
use Net::NTP qw(get_ntp_response);
my %response;
my %inner_result = ();
my $ntp_time;
my @time_servers = qw (
pool.ntp.org
0.pool.ntp.org
1.pool.ntp.org
north-america.pool.ntp.org
0.north-america.pool.ntp.org
1.north-america.pool.ntp.org
2.north-america.pool.ntp.org
3.north-america.pool.ntp.org
time-a.timefreq.bldrdoc.gov
time-c.timefreq.bldrdoc.gov
utcnist.colorado.edu
time.nist.gov
nist1-sj.WiTime.net
www.pool.ntp.org
);
foreach my $time_server (@time_servers) {
print ("Trying time server $time_server\n");
%response = eval{ get_ntp_response($time_server, 123) };
if ($@) {
print "Time server $time_server did not work\n$@\n";
} else {
if ( !(defined($response{"Receive Timestamp"})) or
$response{"Receive Timestamp"} eq "" ) {
say ("Receive Timestamp is bad.");
} else {
$ntp_time = $response{"Receive Timestamp"};
# Note: "Receive Timestamp" has a value something like:
# 1165590056.81202
# We need to get rid of the decimal and everything
# after it.
$ntp_time =~ s/\..*//;
}
}
}
__END__
Results for all time servers are the same:
Trying time server pool.ntp.org
Time server pool.ntp.org did not work
IO::Socket::INET6: getaddrinfo: No such host is known. at C:/Perl/perl/site/lib/Net/NTP.pm line 148.