projects
/
spider.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
04f1823
)
add connect time/uptime for links cmd
author
Dirk Koopman
<djk@tobit.co.uk>
Tue, 26 May 2020 08:18:01 +0000
(09:18 +0100)
committer
Dirk Koopman
<djk@tobit.co.uk>
Tue, 26 May 2020 08:18:01 +0000
(09:18 +0100)
cmd/links.pl
patch
|
blob
|
history
perl/DXUtil.pm
patch
|
blob
|
history
diff --git
a/cmd/links.pl
b/cmd/links.pl
index e53917b4f0e282f6a5541b5cd2f34ba0360e162b..f35545577dce2dd9f78eff231af216ed1428eb3c 100644
(file)
--- a/
cmd/links.pl
+++ b/
cmd/links.pl
@@
-15,8
+15,8
@@
my $dxchan;
my @out;
my $nowt = time;
my @out;
my $nowt = time;
-push @out, " Ave Obs Ping Next Filters";
-push @out, " Callsign Type Started RTT Count Int. Ping Iso? In Out PC92? Address";
+push @out, "
Ave Obs Ping Next Filters";
+push @out, " Callsign Type Started
Uptime
RTT Count Int. Ping Iso? In Out PC92? Address";
foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) {
my $call = $dxchan->call();
foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) {
my $call = $dxchan->call();
@@
-27,8
+27,9
@@
foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) {
my $obscount = $dxchan->nopings;
my $pingint = $dxchan->pingint;
my $lastt = $dxchan->lastping ? ($dxchan->pingint - ($nowt - $dxchan->lastping)) : $pingint;
my $obscount = $dxchan->nopings;
my $pingint = $dxchan->pingint;
my $lastt = $dxchan->lastping ? ($dxchan->pingint - ($nowt - $dxchan->lastping)) : $pingint;
- my $ping = $dxchan->is_node && $dxchan != $main::me ? sprintf("%
8
.2f",$dxchan->pingave) : "";
+ my $ping = $dxchan->is_node && $dxchan != $main::me ? sprintf("%
7
.2f",$dxchan->pingave) : "";
my $iso = $dxchan->isolate ? 'Y' :' ';
my $iso = $dxchan->isolate ? 'Y' :' ';
+ my $uptime = difft($dxchan->startt, 1);
my ($fin, $fout, $pc92) = (' ', ' ', ' ');
if ($dxchan->do_pc9x) {
$pc92 = 'Y';
my ($fin, $fout, $pc92) = (' ', ' ', ' ');
if ($dxchan->do_pc9x) {
$pc92 = 'Y';
@@
-60,7
+61,7
@@
foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) {
}
$ipaddr = 'ax25' if $dxchan->conn->ax25;
}
$ipaddr = 'ax25' if $dxchan->conn->ax25;
- push @out, sprintf "%10s $sort $t
$ping $obscount %5d %5d $iso $fin $fout $pc92 $ipaddr", $call,
$pingint, $lastt;
+ push @out, sprintf "%10s $sort $t
%13s$ping $obscount %5d %5d $iso $fin $fout $pc92 $ipaddr", $call, $uptime ,
$pingint, $lastt;
}
return (1, @out)
}
return (1, @out)
diff --git
a/perl/DXUtil.pm
b/perl/DXUtil.pm
index 500a615023ebdcf3fcf22fd001d715814c9372f2..8453d3df0631c5ba77b9c1710ec1b2c610c21589 100644
(file)
--- a/
perl/DXUtil.pm
+++ b/
perl/DXUtil.pm
@@
-529,25
+529,36
@@
sub diffms
sub difft
{
my $b = shift;
sub difft
{
my $b = shift;
+ my $adds = shift;
+
my $t;
if (ref $b eq 'ARRAY') {
$t = $b->[1] - $b->[0];
} else {
my $t;
if (ref $b eq 'ARRAY') {
$t = $b->[1] - $b->[0];
} else {
- $t = shift() - $b;
+ if ($adds >= $b) {
+ $t = $adds - $b;
+ $adds = shift;
+ } else {
+ $t = $main::systime - $b;
+ }
}
return '-(ve)' if $t < 0;
my ($d,$h,$m,$s);
my $out = '';
$d = int $t / 86400;
}
return '-(ve)' if $t < 0;
my ($d,$h,$m,$s);
my $out = '';
$d = int $t / 86400;
- $out .=
"${d}d"
if $d;
+ $out .=
sprintf ("%s${d}d", $adds?' ':'')
if $d;
$t -= $d * 86400;
$h = int $t / 3600;
$t -= $d * 86400;
$h = int $t / 3600;
- $out .= "${h}h" if $h || $d;
+ $out .= sprintf ("%s${h}h", $adds?' ':'') if $h;
+# $out .= "${h}h" if $h || $d;
$t -= $h * 3600;
$m = int $t / 60;
$t -= $h * 3600;
$m = int $t / 60;
- $out .= "${m}m" if $m || $h || $d;
+ $out .= sprintf ("%s${m}m", $adds?' ':'') if $m;
+# $out .= "${m}m" if $m || $h || $d;
$s = int $t % 60;
$s = int $t % 60;
- $out .= "${s}s";
+ $out .= sprintf ("%s${s}s", $adds?' ':'') if $s;
+ # $out .= "${s}s";
+ $out ||= sprintf ("%s0s", $adds?' ':'');
return $out;
}
return $out;
}