p141 - support new PS UTC timestamps

This commit is contained in:
steffen123 2008-11-07 20:26:03 +00:00
parent 5a045f944f
commit 56c928ccdc

View File

@ -817,17 +817,26 @@ def parseHandStartTime(topline, site):
topline=topline[0:pos+1]+"0"+topline[pos+1:] topline=topline[0:pos+1]+"0"+topline[pos+1:]
counter+=1 counter+=1
if counter==10: break if counter==10: break
isUTC=False
if site=="ftp": if site=="ftp":
pos = topline.find(" ", len(topline)-26)+1 pos = topline.find(" ", len(topline)-26)+1
tmp = topline[pos:] tmp = topline[pos:]
#print "year:", tmp[14:18], "month", tmp[19:21], "day", tmp[22:24], "hour", tmp[0:2], "minute", tmp[3:5], "second", tmp[6:8] #print "year:", tmp[14:18], "month", tmp[19:21], "day", tmp[22:24], "hour", tmp[0:2], "minute", tmp[3:5], "second", tmp[6:8]
result = datetime.datetime(int(tmp[14:18]), int(tmp[19:21]), int(tmp[22:24]), int(tmp[0:2]), int(tmp[3:5]), int(tmp[6:8])) result = datetime.datetime(int(tmp[14:18]), int(tmp[19:21]), int(tmp[22:24]), int(tmp[0:2]), int(tmp[3:5]), int(tmp[6:8]))
elif site=="ps": elif site=="ps":
tmp=topline[-30:] if topline.find("UTC")!=-1:
#print "parsehandStartTime, tmp:", tmp pos1 = topline.find("-")+2
pos = tmp.find("-")+2 pos2 = topline.find("UTC")
tmp = tmp[pos:] tmp=topline[pos1:pos2]
isUTC=True
print "UTC tmp:",tmp
else:
tmp=topline[-30:]
#print "parsehandStartTime, tmp:", tmp
pos = tmp.find("-")+2
tmp = tmp[pos:]
print "ET tmp:",tmp
#Need to match either #Need to match either
# 2008/09/07 06:23:14 ET or # 2008/09/07 06:23:14 ET or
# 2008/08/17 - 01:14:43 (ET) # 2008/08/17 - 01:14:43 (ET)
@ -837,9 +846,10 @@ def parseHandStartTime(topline, site):
else: else:
raise FpdbError("invalid site in parseHandStartTime") raise FpdbError("invalid site in parseHandStartTime")
if site=="ftp" or site=="ps": #these use US ET if (site=="ftp" or site=="ps") and not isUTC: #these use US ET
result+=datetime.timedelta(hours=5) result+=datetime.timedelta(hours=5)
print "parseHandStartTime result:",result
return result return result
#end def parseHandStartTime #end def parseHandStartTime