1N/A# Copyright (c) 1995-1998 Graham Barr <gbarr@pobox.com>. All rights reserved. 1N/A# This program is free software; you can redistribute it and/or 1N/A# modify it under the same terms as Perl itself. 1N/A unless $s->
recv($
buf,
length(
pack(
"N",
0)));
1N/A # unpack, we | 0 to ensure we have an unsigned 1N/A # the time protocol return time in seconds since 1900, convert 1N/A # it to a the required format 1N/A if($^O
eq "MacOS") {
1N/A # MacOS return seconds since 1904, 1900 was not a leap year. 1N/A # otherwise return seconds since 1972, there were 17 leap years between 1N/ANet::Time - time and daytime network client interface 1N/A use Net::Time qw(inet_time inet_daytime); 1N/A print inet_time(); # use default host from Net::Config 1N/A print inet_time('localhost'); 1N/A print inet_time('localhost', 'tcp'); 1N/A print inet_daytime(); # use default host from Net::Config 1N/A print inet_daytime('localhost'); 1N/A print inet_daytime('localhost', 'tcp'); 1N/AC<Net::Time> provides subroutines that obtain the time on a remote machine. 1N/A=item inet_time ( [HOST [, PROTOCOL [, TIMEOUT]]]) 1N/AObtain the time on C<HOST>, or some default host if C<HOST> is not given 1N/Aor not defined, using the protocol as defined in RFC868. The optional 1N/Aargument C<PROTOCOL> should define the protocol to use, either C<tcp> or 1N/AC<udp>. The result will be a time value in the same units as returned 1N/Aby time() or I<undef> upon failure. 1N/A=item inet_daytime ( [HOST [, PROTOCOL [, TIMEOUT]]]) 1N/AObtain the time on C<HOST>, or some default host if C<HOST> is not given 1N/Aor not defined, using the protocol as defined in RFC867. The optional 1N/Aargument C<PROTOCOL> should define the protocol to use, either C<tcp> or 1N/AC<udp>. The result will be an ASCII string or I<undef> upon failure. 1N/AGraham Barr <gbarr@pobox.com> 1N/ACopyright (c) 1995-1998 Graham Barr. All rights reserved. 1N/AThis program is free software; you can redistribute it and/or modify 1N/Ait under the same terms as Perl itself.