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 \s-1NTP\s0 server and then decode the packet received into it's respective parts - as outlined in \s-1RFC1305\s0 and \s-1RFC2030\s0.
This module exports a single method (get_ntp_response) and returns an associative array based upon \s-1RFC1305\s0 and \s-1RFC2030\s0. The response from the server is \*(L"humanized\*(R" to a point that further processing of the information received from the server can be manipulated. For example: timestamps are in epoch, so one could use the localtime function to produce an even more \*(L"human\*(R" 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 \s-1RFC1305\s0. It \*(L"normalizes\*(R" or \*(L"humanizes\*(R" various parts of the packet. For example: all the timestamps are in epoch, \s-1NOT\s0 hexidecimal.
perl, IO::Socket, \s-1RFC1305\s0, \s-1RFC2030\s0
Now maintained by Ask BjA\*~Xrn Hansen, <[email protected]<gt>
Originally by James G. Willmore, <jwillmore (at) adelphia.net<gt> or <owner (at) ljcomputing.net<gt>
Special thanks to Ralf D. Kloth <ralf (at) qrq.de<gt> for the code to decode \s-1NTP\s0 packets.
Copyright 2009 by Ask BjA\*~Xrn 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.