- my @dx = @_;
- my $t = ztime($dx[2]);
- my $d = cldate($dx[2]);
- return sprintf "%8.1f %-11s %s %s %-28.28s%7s>", $dx[0], $dx[1], $d, $t, $dx[3], "<$dx[4]" ;
+ my @dx = @_;
+ my $t = ztime($dx[2]);
+ my $d = cldate($dx[2]);
+ return sprintf "%8.1f %-11s %s %s %-28.28s%7s>", $dx[0], $dx[1], $d, $t, $dx[3], "<$dx[4]" ;
+}
+
+#
+# return all the spots from a day's file as an array of references
+# the parameter passed is a julian day
+sub readfile
+{
+ my @spots;
+
+ my $fh = $fp->open(@_);
+ if ($fh) {
+ my $in;
+ while (<$fh>) {
+ chomp;
+ push @spots, [ split '\^' ];
+ }
+ }
+ return @spots;
+}
+
+# enter the spot for dup checking and return true if it is already a dup
+sub dup
+{
+ my ($freq, $call, $d, $text) = @_;
+
+ # dump if too old
+ return 2 if $d < $main::systime - $dupage;
+
+ $freq = sprintf "%.1f", $freq; # normalise frequency
+ $d /= 60; # to the nearest minute
+ chomp $text;
+ $text = substr($text, 0, $duplth) if length $text > $duplth;
+ my $dupkey = "$freq|$call|$d|$text";
+ return 1 if exists $dup{$dupkey};
+ $dup{$dupkey} = $d * 60; # in seconds (to the nearest minute)
+ return 0;