]> www.dxcluster.org Git - spider.git/blob - perl/test_lastid.pl
try to fix unblessed refs in PC34s
[spider.git] / perl / test_lastid.pl
1 #!/usr/bin/perl
2
3 my $pc9x_past_age = 3600;
4 my $pc9x_future_age = 3600*2;
5 my $lastid;
6
7 try($_) for qw(85955 85968 518 85967 519 85968 520 85969), @ARGV;
8
9 exit 0;
10
11 sub try
12 {
13         my $t = shift;
14
15         print "$t : ";
16
17         if (defined $lastid) {
18                 if ($t < $lastid) {
19                         my $wt;
20                         if (($wt = $t+86400-$lastid) > $pc9x_past_age) {
21                                 print "PCPROT: dup id on $t + 86400 - $lastid ($wt) > $pc9x_past_age, ignored\n";
22                                 return;
23                         }
24                         print "wt = $wt ";
25                 } elsif ($t == $lastid) {
26                         print "PCPROT: dup id on $t == $lastid, ignored\n";
27                         return;
28                 } elsif ($t > $lastid) {
29                         if ($t - $lastid > $pc9x_future_age) {
30                                 print "PCPROT: dup id $t too far in future on $lastid\n";
31                                 return;
32                         }
33                 }
34         }
35
36         print "$lastid Ok\n";
37         $lastid = $t;
38 }
39
40