From 7070c1431ae852d1d4e6b3f580729e1a6dba7bc2 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 8 Jul 2010 21:28:21 +0200 Subject: [PATCH] put timezone removal into separate method for use by PSS --- pyfpdb/PokerStarsToFpdb.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index 78808317..23de7565 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -227,17 +227,7 @@ class PokerStars(HandHistoryConverter): #tz = a.group('TZ') # just assume ET?? #print " tz = ", tz, " datetime =", datetimestr hand.starttime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET" - # approximate rules for ET daylight savings time: - if ( hand.starttime.month == 12 # all of Dec - or (hand.starttime.month == 11 and hand.starttime.day > 4) # and most of November - or hand.starttime.month < 3 # and all of Jan/Feb - or (hand.starttime.month == 3 and hand.starttime.day < 11) ): # and 1st 10 days of March - offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving) - else: - offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving) - # adjust time into UTC: - hand.starttime = hand.starttime + offset - #print " tz = %s start = %s" % (tz, str(hand.starttime)) + self.removeET(hand) if key == 'HID': hand.handid = info[key] if key == 'TOURNO': @@ -277,7 +267,21 @@ class PokerStars(HandHistoryConverter): if key == 'PLAY' and info['PLAY'] is not None: # hand.currency = 'play' # overrides previously set value hand.gametype['currency'] = 'play' - + + def removeET(self, hand): + # approximate rules for ET daylight savings time: + if ( hand.starttime.month == 12 # all of Dec + or (hand.starttime.month == 11 and hand.starttime.day > 4) # and most of November + or hand.starttime.month < 3 # and all of Jan/Feb + or (hand.starttime.month == 3 and hand.starttime.day < 11) ): # and 1st 10 days of March + offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving) + else: + offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving) + # adjust time into UTC: + hand.starttime = hand.starttime + offset + #print " tz = %s start = %s" % (tz, str(hand.starttime)) + #end def removeET + def readButton(self, hand): m = self.re_Button.search(hand.handText) if m: