def get_localzone_name():
 handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
 TZLOCALKEYNAME = 'SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation'
 localtz = winreg.OpenKey(handle, TZLOCALKEYNAME)
 keyvalues = valuestodict(localtz)
 localtz.Close()
 if ('TimeZoneKeyName' in keyvalues):
  tzkeyname = keyvalues['TimeZoneKeyName'].split('\x00', 1)[0]
 else:
  tzwin = keyvalues['StandardName']
  TZKEYNAME = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones'
  tzkey = winreg.OpenKey(handle, TZKEYNAME)
  tzkeyname = None
  for i in range(winreg.QueryInfoKey(tzkey)[0]):
   subkey = winreg.EnumKey(tzkey, i)
   sub = winreg.OpenKey(tzkey, subkey)
   data = valuestodict(sub)
   sub.Close()
   if (data['Std'] == tzwin):
    tzkeyname = subkey
    break
  tzkey.Close()
  handle.Close()
 if (tzkeyname is None):
  raise LookupError('Can not find Windows timezone configuration')
 timezone = win_tz.get(tzkeyname)
 if (timezone is None):
  timezone = win_tz.get((tzkeyname + ' Standard Time'))
 return timezone

def get_localzone_name ( ) : handle = winreg . ConnectRegistry ( None , winreg . HKEY_LOCAL_MACHINE ) TZLOCALKEYNAME = 'SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation' localtz = winreg . OpenKey ( handle , TZLOCALKEYNAME ) keyvalues = valuestodict ( localtz ) localtz . Close ( ) if ( 'TimeZoneKeyName' in keyvalues ) : tzkeyname = keyvalues [ 'TimeZoneKeyName' ] . split ( '\x00' , 1 ) [ 0 ] else : tzwin = keyvalues [ 'StandardName' ] TZKEYNAME = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones' tzkey = winreg . OpenKey ( handle , TZKEYNAME ) tzkeyname = None for i in range ( winreg . QueryInfoKey ( tzkey ) [ 0 ] ) : subkey = winreg . EnumKey ( tzkey , i ) sub = winreg . OpenKey ( tzkey , subkey ) data = valuestodict ( sub ) sub . Close ( ) if ( data [ 'Std' ] == tzwin ) : tzkeyname = subkey break tzkey . Close ( ) handle . Close ( ) if ( tzkeyname is None ) : raise LookupError ( 'Can not find Windows timezone configuration' ) timezone = win_tz . get ( tzkeyname ) if ( timezone is None ) : timezone = win_tz . get ( ( tzkeyname + ' Standard Time' ) ) return timezone
get local time zone name .