Changeset 22:49f704595c3b in livinglogic.python.tipimaid

Show
Ignore:
Timestamp:
11/26/08 18:35:29 (10 years ago)
Author:
Nikolas Tautenhahn <nik@…>
Branch:
default
Message:

don't use datetime.datetime.strptime(), do ancient ugly things to keep python < 2.5 happy

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • liaalh.py

    r21 r22  
    44# Apache sends a SIGTERM to its piped logger when it exits - when apache is killed with -9, it doesn't send anything 
    55 
    6 import sys, os, datetime, errno, bisect, re, gzip, signal 
     6import sys, os, datetime, errno, bisect, re, gzip, signal, time 
    77 
    88 
     
    8383    def apachedate2utc(self, d): 
    8484        temp = d.split() 
    85         utcdate = datetime.datetime.strptime(temp[0], "%d/%b/%Y:%H:%M:%S") 
     85        utcdate = datetime.datetime(*(time.strptime(temp[0], "%d/%b/%Y:%H:%M:%S")[0:6])) # support ancient distributions with python < 2.5 
     86#       utcdate = datetime.datetime.strptime(temp[0], "%d/%b/%Y:%H:%M:%S") 
    8687        minsoff = int("%s%s" % (temp[1][0], temp[1][-2:])) 
    8788        hrsoff = int("%s%s" % (temp[1][0], temp[1][1:3]))