projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fiz strange carp errors on startup with no route_*_cache files
[spider.git]
/
perl
/
DXUtil.pm
diff --git
a/perl/DXUtil.pm
b/perl/DXUtil.pm
index b8ff16d1b3ba50605316a2f645f85e9929e6d5a2..b42d808d0e0aaa149b444e212e108e43420bb5d0 100644
(file)
--- a/
perl/DXUtil.pm
+++ b/
perl/DXUtil.pm
@@
-29,7
+29,7
@@
require Exporter;
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 _diffus difft parraydifft is_ztime basecall
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 _diffus difft parraydifft is_ztime basecall
- normalise_call
+ normalise_call
is_numeric
);
);
@@
-222,7
+222,7
@@
sub phash
my $ref = shift;
my $out;
my $ref = shift;
my $out;
-
while (my $k =
sort keys %$ref) {
+
foreach my $k (
sort keys %$ref) {
$out .= "${k}=>$ref->{$k}, ";
}
$out =~ s/, $// if $out;
$out .= "${k}=>$ref->{$k}, ";
}
$out =~ s/, $// if $out;
@@
-448,7
+448,7
@@
sub is_latlong
# is it an ip address?
sub is_ipaddr
{
# is it an ip address?
sub is_ipaddr
{
- return $_[0] =~ /^
\d+\.\d+\.\d+\.\d+$/ || $_[0] =~ /^[0-9a-f:,]+$/
;
+ return $_[0] =~ /^
(?:(?:\:\:)?\d+\.\d+\.\d+\.\d+)|(?:[0-9a-f]{1,4}\:)?(?:\:[0-9a-f]{1,4}){1,6}$/i
;
}
# is it a zulu time hhmmZ
}
# is it a zulu time hhmmZ
@@
-565,8
+565,11
@@
sub difft
}
}
return '-(ve)' if $t < 0;
}
}
return '-(ve)' if $t < 0;
- my ($d,$h,$m,$s);
+ my ($
y,$
d,$h,$m,$s);
my $out = '';
my $out = '';
+ $y = int $t / (86400*365);
+ $out .= sprintf ("%s${y}y", $adds?' ':'') if $y;
+ $t -= $y * 86400 * 365;
$d = int $t / 86400;
$out .= sprintf ("%s${d}d", $adds?' ':'') if $d;
$t -= $d * 86400;
$d = int $t / 86400;
$out .= sprintf ("%s${d}d", $adds?' ':'') if $d;
$t -= $d * 86400;
@@
-611,3
+614,8
@@
sub normalise_call
$ncall .= "-$ssid" if $ssid;
return $ncall;
}
$ncall .= "-$ssid" if $ssid;
return $ncall;
}
+
+sub is_numeric
+{
+ return $_[0] =~ /^[\.\d]+$/;
+}