Commit cbbac009 authored by 's avatar

Added contributed DateTime patch to set a GMT-based _localzone if the

local timezone name does not appear in the set of recognized time zone
names.
parent 924f851b
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Encapsulation of date/time values""" """Encapsulation of date/time values"""
__version__='$Revision: 1.34 $'[11:-2] __version__='$Revision: 1.35 $'[11:-2]
import sys, os, math, regex, DateTimeZone import sys, os, math, regex, DateTimeZone
...@@ -690,8 +690,20 @@ class DateTime: ...@@ -690,8 +690,20 @@ class DateTime:
'thursday': 5, 'thurs': 5, 'thur': 5, 'thu': 5, 'thursday': 5, 'thurs': 5, 'thur': 5, 'thu': 5,
'friday': 6, 'fri': 6, 'friday': 6, 'fri': 6,
'saturday': 7, 'sat': 7} 'saturday': 7, 'sat': 7}
try: _localzone =_cache._zmap[lower(tzname[0])]
except: _localzone=''
try: _localzone=_cache._zmap[lower(tzname[0])]
except:
try:
t=time()
localzone=mktime(gmtime(t))-t
localzone=int(round(-localzone/(60*60)))
if localzone >= 0:
zn='+%d' % localzone
else: lz=str(localzone)
_localzone=_cache._zmap[lower('GMT%s' % lz)]
except: _localzone=''
_tzinfo =_cache() _tzinfo =_cache()
def _parse(self,string): def _parse(self,string):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment