From 56c928ccdc1888d2af956428d98eeea62ecd9e43 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 7 Nov 2008 20:26:03 +0000 Subject: [PATCH] p141 - support new PS UTC timestamps --- pyfpdb/fpdb_simple.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index ab442d85..6b532e97 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -817,17 +817,26 @@ def parseHandStartTime(topline, site): topline=topline[0:pos+1]+"0"+topline[pos+1:] counter+=1 if counter==10: break - + + isUTC=False if site=="ftp": pos = topline.find(" ", len(topline)-26)+1 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] 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": - tmp=topline[-30:] - #print "parsehandStartTime, tmp:", tmp - pos = tmp.find("-")+2 - tmp = tmp[pos:] + if topline.find("UTC")!=-1: + pos1 = topline.find("-")+2 + pos2 = topline.find("UTC") + 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 # 2008/09/07 06:23:14 ET or # 2008/08/17 - 01:14:43 (ET) @@ -837,9 +846,10 @@ def parseHandStartTime(topline, site): else: 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) + print "parseHandStartTime result:",result return result #end def parseHandStartTime