X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FGeomag.pm;h=037dcc50be74637e6d4721f962066789dd3b6106;hb=ce732002f6913bef502e168460ea3cc688fa3d8b;hp=1a1a8a40110905579d6b603c672a0701df4bfffe;hpb=c961a6af6d9aec8eba4d58803f890fc514a109cc;p=spider.git diff --git a/perl/Geomag.pm b/perl/Geomag.pm index 1a1a8a40..037dcc50 100644 --- a/perl/Geomag.pm +++ b/perl/Geomag.pm @@ -15,10 +15,13 @@ use DXUtil; use DXLog; use Julian; use IO::File; -use Carp; +use DXDebug; +use DXDupe; use strict; -use vars qw($date $sfi $k $a $r $forecast @allowed @denied $fp $node $from); +use vars qw($date $sfi $k $a $r $forecast @allowed @denied $fp $node $from + $dirprefix $param + $duplth $dupage); $fp = 0; # the DXLog fcb $date = 0; # the unix time of the WWV (notional) @@ -31,13 +34,15 @@ $node = ""; # originating node $from = ""; # who this came from @allowed = (); # if present only these callsigns are regarded as valid WWV updators @denied = (); # if present ignore any wwv from these callsigns -my $dirprefix = "$main::data/wwv"; -my $param = "$dirprefix/param"; +$duplth = 20; # the length of text to use in the deduping +$dupage = 12*3600; # the length of time to hold spot dups + +$dirprefix = "$main::data/wwv"; +$param = "$dirprefix/param"; sub init { $fp = DXLog::new('wwv', 'dat', 'm'); - mkdir $dirprefix, 0777 if !-e $dirprefix; # now unnecessary DXLog will create it do "$param" if -e "$param"; confess $@ if $@; } @@ -238,5 +243,23 @@ sub readfile } return @in; } + +# enter the spot for dup checking and return true if it is already a dup +sub dup +{ + my ($d, $sfi, $k, $a, $text) = @_; + + # dump if too old + return 2 if $d < $main::systime - $dupage; + + my $dupkey = "W$d|$sfi|$k|$a"; + return DXDupe::check($dupkey, $main::systime+$dupage); +} + +sub listdups +{ + return DXDupe::listdups('W', $dupage, @_); +} 1; __END__; +