X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=28e7396dcebd3143d25d29b49c989e98c4c7592d;hb=f6abc902d49e13eeca3ff50f84a74f28a3aa3390;hp=157ff609534515009faf6ff07914e690784fd349;hpb=55483e59b83bd5c514303f0955be5e0dddcbc320;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 157ff609..28e7396d 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -27,7 +27,7 @@ require Exporter; print_all_fields cltounix unpad is_callsign is_latlong is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem is_prefix dd is_ipaddr $pi $d2r $r2d localdata localdata_mv - diffms + diffms _diffms ); @@ -499,17 +499,23 @@ sub localdata_mv } # measure the time taken for something to happen; use Time::HiRes qw(gettimeofday tv_interval); +sub _diffms +{ + my $ta = shift; + my $tb = shift || [gettimeofday]; + my $a = int($ta->[0] * 1000) + int($ta->[1] / 1000); + my $b = int($tb->[0] * 1000) + int($tb->[1] / 1000); + return $b - $a; +} + sub diffms { my $call = shift; my $line = shift; my $ta = shift; my $no = shift; - my $tb = shift || [gettimeofday]; - - my $a = int($ta->[0] * 1000) + int($ta->[1] / 1000); - my $b = int($tb->[0] * 1000) + int($tb->[1] / 1000); - my $msecs = $b - $a; + my $tb = shift; + my $msecs = _diffms($ta, $tb); $line =~ s|\s+$||; my $s = "subprocess stats cmd: '$line' $call ${msecs}mS";