Ask Bjørn Hansen
and 1 contributors


Net::NTP - Perl extension for decoding NTP server responses


  use Net::NTP qw(get_ntp_response);
  my %response = get_ntp_response();


All this module does is send a packet to an NTP server and then decode the packet recieved into it's respective parts - as outlined in RFC1305 and RFC2030.


This module exports a single method (get_ntp_response) and returns an associative array based upon RFC1305 and RFC2030. The response from the server is "humanized" to a point that further processing of th information recieved from the server can be manipulated. For example: timestamps are in epoch, so one could use the localtime function to produce an even more "human" representation of the timestamp.


get_ntp_response(<server>, <port>);

This module exports a single method - get_ntp_response. It takes the server as the first argument (localhost is the default) and port to send/recieve the packets (ntp or 123 bu default). It returns an associative array of the various parts of the packet as outlined in RFC1305. It "normalizes" or "humanizes" various parts of the packet. For example: all the timestamps are in epoch, NOT hexidecimal.


perl, IO::Socket, RFC1305, RFC2030


Now maintained by Ask Bjørn Hansen, <<gt>

Originally by James G. Willmore, <jwillmore (at)<gt> or <owner (at)<gt>

Special thanks to Ralf D. Kloth <ralf (at)<gt> for the code to decode NTP packets.


Copyright 2009 by Ask Bjørn Hansen; 2004 by James G. Willmore

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 249:

Non-ASCII character seen before =encoding in 'Bjørn'. Assuming UTF-8