[pywin32-checkins] pywin32/win32/Lib win32timezone.py,1.21,1.22
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Jason R. C. <ja...@us...> - 2009-01-19 00:32:01
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13459 Modified Files: win32timezone.py Log Message: Added ability to pickle a TimeZoneInformation created from a TimeZoneDefinition. Added the DYNAMIC_TIME_ZONE_INFORMATION structure (considering this as the basis for TimeZoneDefinition). Index: win32timezone.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32timezone.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** win32timezone.py 18 Jan 2009 21:50:27 -0000 1.21 --- win32timezone.py 19 Jan 2009 00:31:49 -0000 1.22 *************** *** 78,81 **** --- 78,87 ---- True + It's possible to construct a TimeZoneInfo from a TimeZoneDescription + including the currently-defined zone. + >>> tz = win32timezone.TimeZoneInfo(TimeZoneDefinition.current()) + >>> tz == pickle.loads(pickle.dumps(tz)) + True + >>> aest = win32timezone.TimeZoneInfo('AUS Eastern Standard Time') >>> est = win32timezone.TimeZoneInfo('E. Australia Standard Time') *************** *** 154,157 **** --- 160,164 ---- import win32api import ctypes + import ctypes.wintypes import re import sys *************** *** 193,196 **** --- 200,209 ---- ] + class DYNAMIC_TIME_ZONE_INFORMATION(ctypes.Structure): + _fields_ = TIME_ZONE_INFORMATION._fields_ + [ + ('key_name', ctypes.c_wchar*128), + ('dynamic_daylight_time_disabled', ctypes.wintypes.BOOL), + ] + # define a couple of functions to enable ctypes.Structure pickling def __construct_structure(type_, buffer): *************** *** 351,355 **** tzRegKey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' ! def __init__(self, param, fix_standard_time=False): if isinstance(param, TimeZoneDefinition): self._LoadFromTZI(param) --- 364,368 ---- tzRegKey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' ! def __init__(self, param=None, fix_standard_time=False): if isinstance(param, TimeZoneDefinition): self._LoadFromTZI(param) *************** *** 374,380 **** return result - def __getinitargs__(self): - return (self.timeZoneName,) - def _LoadInfoFromKey(self): """Loads the information from an opened time zone registry key --- 387,390 ---- |