changeset 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 5a66fea952fe
children 11541129a389
files scan.pl
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scan.pl	Thu Oct 30 15:00:17 2008 +0800
+++ b/scan.pl	Thu Oct 30 16:05:11 2008 +0800
@@ -13,8 +13,7 @@
         return;
     }
 
-    foreach my $h_city (@cities)
-    {
+    foreach my $h_city (@cities) {
         $h_city->{island} = $island;
         $h_city->{'time'} = time;
         my $c = Ikariam::Cities->retrieve($h_city->{cityId});
@@ -28,7 +27,7 @@
         $c->update();
 
         my $user = Ikariam::User->retrieve($h_city->{'user'});
-        next if (defined($user) && $user->time le (time - 60*60*1));
+        next if (defined($user) && defined($user->time) && (time - 60*60*1) ge $user->time);
 
         saveUser($h_city->{owner});
     }
@@ -96,6 +95,7 @@
 } else {
     die("Usage: $0\nUsage: $0 x y\n");
 }
+
 foreach my $h_island (@islands)
 {
     printf("checking island %d\n", $h_island->{id});