1.1 --- a/EventAggregatorSupport.py Sun Mar 25 21:35:07 2012 +0200
1.2 +++ b/EventAggregatorSupport.py Mon Mar 26 00:26:56 2012 +0200
1.3 @@ -76,7 +76,7 @@
1.4 month_regexp_str = ur'(?P<year>[0-9]{4})-(?P<month>[0-9]{2})'
1.5 date_regexp_str = ur'(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})'
1.6 time_regexp_str = ur'(?P<hour>[0-2][0-9]):(?P<minute>[0-5][0-9])(?::(?P<second>[0-6][0-9]))?'
1.7 -timezone_offset_str = ur'(?P<offset>(UTC)?(?:(?P<sign>[-+])(?P<hours>[0-9]{2})(?::?(?P<minutes>[0-9]{2}))?))'
1.8 +timezone_offset_str = ur'(?P<offset>(UTC)?(?:(?P<sign>[-+])?(?P<hours>[0-9]{2})(?::?(?P<minutes>[0-9]{2}))?))'
1.9 timezone_olson_str = ur'(?P<olson>[a-zA-Z]+(?:/[-_a-zA-Z]+){1,2})'
1.10 timezone_utc_str = ur'UTC'
1.11 timezone_regexp_str = ur'(?P<zone>' + timezone_offset_str + '|' + timezone_olson_str + '|' + timezone_utc_str + ')'
1.12 @@ -2057,12 +2057,12 @@
1.13 match = timezone_offset_regexp.match(zone)
1.14 if match:
1.15 if match.group("sign") == "-":
1.16 - sign = -1
1.17 + offset_sign = -1
1.18 else:
1.19 - sign = 1
1.20 -
1.21 - hours = int(match.group("hours")) * sign
1.22 - minutes = int(match.group("minutes") or 0) * sign
1.23 + offset_sign = 1
1.24 +
1.25 + hours = int(match.group("hours")) * offset_sign
1.26 + minutes = int(match.group("minutes") or 0) * offset_sign
1.27 return hours, minutes
1.28
1.29 # Attempt to handle Olson time zone identifiers.
1.30 @@ -2070,9 +2070,9 @@
1.31 dt = self.as_olson_datetime()
1.32 if dt:
1.33 seconds = dt.utcoffset().seconds + dt.utcoffset().days * 24 * 3600
1.34 - hours = seconds / 3600
1.35 - minutes = (seconds % 3600) / 60
1.36 - return hours, minutes
1.37 + hours = abs(seconds) / 3600
1.38 + minutes = (abs(seconds) % 3600) / 60
1.39 + return sign(seconds) * hours, sign(seconds) * minutes
1.40
1.41 # Otherwise return None.
1.42