use Time::HiRes whenever available, independently of perl version
This commit is contained in:
Родитель
7bede9180d
Коммит
271dc9c582
|
@ -44,7 +44,9 @@ require "getpart.pm";
|
||||||
require "ftp.pm";
|
require "ftp.pm";
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
if($] >= 5.007003) {
|
# sub second timestamping needs Time::HiRes
|
||||||
|
eval {
|
||||||
|
no warnings "all";
|
||||||
require Time::HiRes;
|
require Time::HiRes;
|
||||||
import Time::HiRes qw( gettimeofday );
|
import Time::HiRes qw( gettimeofday );
|
||||||
}
|
}
|
||||||
|
@ -141,7 +143,8 @@ sub getlogfilename {
|
||||||
#
|
#
|
||||||
sub logmsg {
|
sub logmsg {
|
||||||
my $now;
|
my $now;
|
||||||
if($] >= 5.007003) {
|
# sub second timestamping needs Time::HiRes
|
||||||
|
if($Time::HiRes::VERSION) {
|
||||||
my ($seconds, $usec) = gettimeofday();
|
my ($seconds, $usec) = gettimeofday();
|
||||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
||||||
localtime($seconds);
|
localtime($seconds);
|
||||||
|
|
|
@ -58,8 +58,9 @@
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
@INC=(@INC, $ENV{'srcdir'}, ".");
|
@INC=(@INC, $ENV{'srcdir'}, ".");
|
||||||
# run time statistics needs perl 5.7 or newer
|
# run time statistics needs Time::HiRes
|
||||||
if($] >= 5.007003) {
|
eval {
|
||||||
|
no warnings "all";
|
||||||
require Time::HiRes;
|
require Time::HiRes;
|
||||||
import Time::HiRes qw( time );
|
import Time::HiRes qw( time );
|
||||||
}
|
}
|
||||||
|
@ -3080,8 +3081,8 @@ while(@ARGV) {
|
||||||
$keepoutfiles=1;
|
$keepoutfiles=1;
|
||||||
}
|
}
|
||||||
elsif($ARGV[0] eq "-r") {
|
elsif($ARGV[0] eq "-r") {
|
||||||
# run time statistics needs perl 5.7 or newer
|
# run time statistics needs Time::HiRes
|
||||||
if($] >= 5.007003) {
|
if($Time::HiRes::VERSION) {
|
||||||
keys(%timeprepini) = 1000;
|
keys(%timeprepini) = 1000;
|
||||||
keys(%timesrvrini) = 1000;
|
keys(%timesrvrini) = 1000;
|
||||||
keys(%timesrvrend) = 1000;
|
keys(%timesrvrend) = 1000;
|
||||||
|
@ -3094,8 +3095,8 @@ while(@ARGV) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($ARGV[0] eq "-rf") {
|
elsif($ARGV[0] eq "-rf") {
|
||||||
# run time statistics needs perl 5.7 or newer
|
# run time statistics needs Time::HiRes
|
||||||
if($] >= 5.007003) {
|
if($Time::HiRes::VERSION) {
|
||||||
keys(%timeprepini) = 1000;
|
keys(%timeprepini) = 1000;
|
||||||
keys(%timesrvrini) = 1000;
|
keys(%timesrvrini) = 1000;
|
||||||
keys(%timesrvrend) = 1000;
|
keys(%timesrvrend) = 1000;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче