have LogDirectory use utils.mtime instead of os.stat
authorTero Marttila <terom@fixme.fi>
Wed, 11 Feb 2009 04:04:55 +0200
changeset 102 e396613bc873
parent 101 f5f53cc0ce16
child 103 0e829e6275dc
have LogDirectory use utils.mtime instead of os.stat
log_source.py
--- a/log_source.py	Wed Feb 11 03:58:20 2009 +0200
+++ b/log_source.py	Wed Feb 11 04:04:55 2009 +0200
@@ -377,12 +377,12 @@
         # convert to date and use that
         return self._get_logfile_date(dtz.date())
 
-    def _get_logfile_date (self, d, load=True, stat=False, ignore_missing=True) :
+    def _get_logfile_date (self, d, load=True, mtime=False, ignore_missing=True) :
         """
             Get the logfile corresponding to the given naive date in our timezone. 
             
-            If load is False, only test for the presence of the logfile, do not actually open it. If stat is given,
-            then this returns the stat() result
+            If load is False, only test for the presence of the logfile, do not actually open it. If mtime is given,
+            then this returns the file's mtime
 
             Returns None if the logfile does not exist, unless ignore_missing is given as False.
         """
@@ -398,9 +398,9 @@
                 # open+return the LogFile
                 return LogFile(path, self.parser, self.decoder, start_date=d, channel=self.channel)
             
-            elif stat :
+            elif mtime :
                 # stat
-                return os.stat(path)
+                return utils.mtime(path)
 
             else :
                 # test
@@ -627,10 +627,10 @@
             # compare against dt?
             if dt :
                 # stat
-                st = self._get_logfile_date(log_date, load=False, stat=True)
-
+                mtime = self._get_logfile_date(log_date, load=False, mtime=True)
+                
                 # not modified?
-                if utils.from_utc_timestamp(st.st_mtime) < dt :
+                if mtime < dt :
                     # skip
                     continue