OSDN Git Service

Improved performance.
authorbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sat, 7 Mar 2009 10:55:20 +0000 (10:55 +0000)
committerbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sat, 7 Mar 2009 10:55:20 +0000 (10:55 +0000)
changelog
csa-file-filter

index c70e0bf..0fbeba5 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,8 @@
+2009-03-07 Daigo Moriwaki <daigo at debian dot org>
+
+       * [csa-file-filter]
+         - Improved performance.
+
 2009-02-15 Daigo Moriwaki <daigo at debian dot org>
 
        * [shogi-server]
index 297edc0..681be6f 100755 (executable)
@@ -76,10 +76,8 @@ def filter(filename)
     return unless /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.csa$/ =~ filename
 
     file_date = Date.new($1.to_i, $2.to_i, $3.to_i)
-    now       = Time.now
-    now_date  = Date.new(now.year, now.month, now.day)
 
-    return if now_date - file_date > $options["within"]
+    return if $now_date - file_date > $options["within"]
   end
     
   puts filename
@@ -145,6 +143,8 @@ def main
 end
 
 if __FILE__ == $0
+  now       = Time.now
+  $now_date  = Date.new(now.year, now.month, now.day)
   main
 end