X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Ftime.pl;fp=cmd%2Fshow%2Ftime.pl;h=2054754bc4a874202ab9a63e22a1f18dab920405;hb=a57ea9d5501f6d319a8cbfff997bad077cc31010;hp=0000000000000000000000000000000000000000;hpb=7de34899527cbc4dfacdcc6452926b3d2d73792c;p=spider.git diff --git a/cmd/show/time.pl b/cmd/show/time.pl new file mode 100644 index 00000000..2054754b --- /dev/null +++ b/cmd/show/time.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl +# +# show local times for each callsign or prefix entered +# +# Copyright (c) 1999 Dirk Koopman G1TLH +# +# $Id$ +# + +my ($self, $line) = @_; +my @list = split /\s+/, $line; + +my $l; +my @out; +my $t = $main::systime; + +push @out, $self->msg("time1", cldate($t, 1), ztime($t, 1), ztime($t)); + +if (@list) { + foreach $l (@list) { + # prefixes ---> + my @ans = Prefix::extract($l); + next if !@ans; + my $pre = shift @ans; + my $a; + foreach $a (@ans) { + my $s = sprintf "%-9s %-20s", $pre, $a->name(); + + # UTC offset is in hours.minutes (too late to change it now) AND + # the wrong way round! + my $off = $a->utcoff(); + my $frac = $off - int $off; + $off = (int $off) + (($frac*100)/60); + my ($sec,$min,$hour) = gmtime($t - 3600*$off); + my $buf = sprintf "%02d%02d", $hour, $min; + push @out, $self->msg("time2", $s, $buf, sprintf("%+.1f", -$off)); + } + } +} + +return (1, @out);