X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fdxstats.pl;h=52ac5d82aa4c1125f2f8e6433c1a6a1582056780;hb=refs%2Fheads%2Fnewusers;hp=0b60e7a4bae96b8f9be616f97dd484985af45290;hpb=70ffd373d199a2a83072da4e2b75572a2270383f;p=spider.git diff --git a/cmd/show/dxstats.pl b/cmd/show/dxstats.pl index 0b60e7a4..52ac5d82 100644 --- a/cmd/show/dxstats.pl +++ b/cmd/show/dxstats.pl @@ -3,7 +3,7 @@ # # Copyright (c) 2001 Dirk Koopman G1TLH # -# $Id$ +# # my ($self, $line) = @_; @@ -11,11 +11,34 @@ my @f = split /\s+/, $line; my @calls; my $days = 31; my @dxcc; - -my $now = Julian::Day->new(time())->sub(31); my $i; my @in; +my $now; +my $date = cldate($main::systime); +my $utime = $main::systime; +my @out; + +while (@f) { + my $f = shift @f; + + if ($f =~ /^\d+$/ && $f < 366) { # no of days + $days = $f; + next; + } + if (my $ut = Date::Parse::str2time($f)) { # is it a parseable date? + $utime = $ut+3600; + next; + } + push @out, $self->msg('e33', $f); +} + +return (1, @out) if @out; + +$now = Julian::Day->new($utime); +$now = $now->sub($days); +$date = cldate($utime); + # generate the spot list for ($i = 0; $i < $days; $i++) { my $fh = $Spot::statp->open($now); # get the next file @@ -35,10 +58,9 @@ for ($i = 0; $i < $days; $i++) { $now = $now->add(1); } -my @out; my $tot; -push @out, $self->msg('statdx'); +push @out, $self->msg('statdx', $date, $days); foreach my $ref (@in) { push @out, sprintf "%12s: %7d", $ref->[0]->as_string, $ref->[1]; $tot += $ref->[1];