# Net::Time.pm
#
-# Copyright (c) 1995-1998 Graham Barr <gbarr@pobox.com>. All rights reserved.
+# Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
@ISA = qw(Exporter);
@EXPORT_OK = qw(inet_time inet_daytime);
-$VERSION = "2.08";
+$VERSION = "2.10";
$TIMEOUT = 120;
my $offset = 0 | 0;
return undef
- unless $s->recv($buf, length(pack("N",0)));
+ unless defined $s->recv($buf, length(pack("N",0)));
# unpack, we | 0 to ensure we have an unsigned
my $time = (unpack("N",$buf))[0] | 0;
my $s = _socket('daytime',13,@_) || return undef;
my $buf = '';
- $s->recv($buf, 1024) ? $buf
+ defined($s->recv($buf, 1024)) ? $buf
: undef;
}
=head1 SYNOPSIS
use Net::Time qw(inet_time inet_daytime);
-
+
print inet_time(); # use default host from Net::Config
print inet_time('localhost');
print inet_time('localhost', 'tcp');
-
+
print inet_daytime(); # use default host from Net::Config
print inet_daytime('localhost');
print inet_daytime('localhost', 'tcp');
=head1 COPYRIGHT
-Copyright (c) 1995-1998 Graham Barr. All rights reserved.
+Copyright (c) 1995-2004 Graham Barr. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.