comparison scan.pl @ 121:0bab14dddf60

fixed the timestamp for scanning
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 30 Oct 2008 16:05:11 +0800
parents b35c7aaef8ca
children 6043e9bfdeef
comparison
equal deleted inserted replaced
117:5a66fea952fe 121:0bab14dddf60
11 if ($#cities == -1) { 11 if ($#cities == -1) {
12 warn ("empty cities list.\n"); 12 warn ("empty cities list.\n");
13 return; 13 return;
14 } 14 }
15 15
16 foreach my $h_city (@cities) 16 foreach my $h_city (@cities) {
17 {
18 $h_city->{island} = $island; 17 $h_city->{island} = $island;
19 $h_city->{'time'} = time; 18 $h_city->{'time'} = time;
20 my $c = Ikariam::Cities->retrieve($h_city->{cityId}); 19 my $c = Ikariam::Cities->retrieve($h_city->{cityId});
21 if(defined($c)) { 20 if(defined($c)) {
22 foreach (keys(%$h_city)) { 21 foreach (keys(%$h_city)) {
26 $c = Ikariam::Cities->insert($h_city); 25 $c = Ikariam::Cities->insert($h_city);
27 } 26 }
28 $c->update(); 27 $c->update();
29 28
30 my $user = Ikariam::User->retrieve($h_city->{'user'}); 29 my $user = Ikariam::User->retrieve($h_city->{'user'});
31 next if (defined($user) && $user->time le (time - 60*60*1)); 30 next if (defined($user) && defined($user->time) && (time - 60*60*1) ge $user->time);
32 31
33 saveUser($h_city->{owner}); 32 saveUser($h_city->{owner});
34 } 33 }
35 } 34 }
36 35
94 $i->login; 93 $i->login;
95 @islands = $i->viewHomeMap(); 94 @islands = $i->viewHomeMap();
96 } else { 95 } else {
97 die("Usage: $0\nUsage: $0 x y\n"); 96 die("Usage: $0\nUsage: $0 x y\n");
98 } 97 }
98
99 foreach my $h_island (@islands) 99 foreach my $h_island (@islands)
100 { 100 {
101 printf("checking island %d\n", $h_island->{id}); 101 printf("checking island %d\n", $h_island->{id});
102 102
103 my $island; 103 my $island;