Logo Search packages:      
Sourcecode: fail2ban version File versions  Download package

def logreader::logreader::LogReader::getUnixTime (   self,
  value 
)

Returns the Unix timestamp of the given value.
      Pattern should describe the date construction of
      value.

Definition at line 199 of file logreader.py.

00199                                   :
            """ Returns the Unix timestamp of the given value.
                  Pattern should describe the date construction of
                  value.
            """
            date = list(time.strptime(value, self.timepattern))
            if date[0] < 2000:
                  # There is probably no year field in the logs
                  date[0] = time.gmtime()[0]
                  # Bug fix for #1241756
                  # If the date is greater than the current time, we suppose
                  # that the log is not from this year but from the year before
                  if time.mktime(date) > time.time():
                        date[0] -= 1
            unixTime = time.mktime(date)
            return unixTime
            return unixTime


Generated by  Doxygen 1.6.0   Back to index