(self, path)
Load path, or if path is empty, load local time.
Load path, or if path is empty, load local time.
Load path or if path is empty load local time .
def __init__(self, path):
        """Load path, or if path is empty, load local time."""
        if path:
            keydict = valuesToDict(_winreg.OpenKey(tzparent, path))
            self.display = keydict['Display']
            self.dstname = keydict['Dlt']
            self.stdname = keydict['Std']

            #see http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm
            tup = struct.unpack('=3l16h', keydict['TZI'])
            self.stdoffset = -tup[0] - tup[1]  # Bias + StandardBias * -1
            self.dstoffset = self.stdoffset - tup[2]  # + DaylightBias * -1

            offset = 3
            self.stdmonth = tup[1 + offset]
            self.stddayofweek = tup[2 + offset]  # Sunday=0
            self.stdweeknumber = tup[3 + offset]  # Last = 5
            self.stdhour = tup[4 + offset]
            self.stdminute = tup[5 + offset]

            offset = 11
            self.dstmonth = tup[1 + offset]
            self.dstdayofweek = tup[2 + offset]  # Sunday=0
            self.dstweeknumber = tup[3 + offset]  # Last = 5
            self.dsthour = tup[4 + offset]
            self.dstminute = tup[5 + offset]

        else:
            keydict = valuesToDict(localkey)

            self.stdname = keydict['StandardName']
            self.dstname = keydict['DaylightName']

            sourcekey = _winreg.OpenKey(tzparent, self.stdname)
            self.display = valuesToDict(sourcekey)['Display']

            self.stdoffset = -keydict['Bias'] - keydict['StandardBias']
            self.dstoffset = self.stdoffset - keydict['DaylightBias']

            #see http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm
            tup = struct.unpack('=8h', keydict['StandardStart'])

            offset = 0
            self.stdmonth = tup[1 + offset]
            self.stddayofweek = tup[2 + offset]  # Sunday=0
            self.stdweeknumber = tup[3 + offset]  # Last = 5
            self.stdhour = tup[4 + offset]
            self.stdminute = tup[5 + offset]

            tup = struct.unpack('=8h', keydict['DaylightStart'])
            self.dstmonth = tup[1 + offset]
            self.dstdayofweek = tup[2 + offset]  # Sunday=0
            self.dstweeknumber = tup[3 + offset]  # Last = 5
            self.dsthour = tup[4 + offset]
            self.dstminute = tup[5 + offset]
def __init__ ( self , path ) : if path : keydict = valuesToDict ( _winreg . OpenKey ( tzparent , path ) ) self . display = keydict [ 'Display' ] self . dstname = keydict [ 'Dlt' ] self . stdname = keydict [ 'Std' ] #see http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm tup = struct . unpack ( '=3l16h' , keydict [ 'TZI' ] ) self . stdoffset = - tup [ 0 ] - tup [ 1 ] # Bias + StandardBias * -1 self . dstoffset = self . stdoffset - tup [ 2 ] # + DaylightBias * -1 offset = 3 self . stdmonth = tup [ 1 + offset ] self . stddayofweek = tup [ 2 + offset ] # Sunday=0 self . stdweeknumber = tup [ 3 + offset ] # Last = 5 self . stdhour = tup [ 4 + offset ] self . stdminute = tup [ 5 + offset ] offset = 11 self . dstmonth = tup [ 1 + offset ] self . dstdayofweek = tup [ 2 + offset ] # Sunday=0 self . dstweeknumber = tup [ 3 + offset ] # Last = 5 self . dsthour = tup [ 4 + offset ] self . dstminute = tup [ 5 + offset ] else : keydict = valuesToDict ( localkey ) self . stdname = keydict [ 'StandardName' ] self . dstname = keydict [ 'DaylightName' ] sourcekey = _winreg . OpenKey ( tzparent , self . stdname ) self . display = valuesToDict ( sourcekey ) [ 'Display' ] self . stdoffset = - keydict [ 'Bias' ] - keydict [ 'StandardBias' ] self . dstoffset = self . stdoffset - keydict [ 'DaylightBias' ] #see http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm tup = struct . unpack ( '=8h' , keydict [ 'StandardStart' ] ) offset = 0 self . stdmonth = tup [ 1 + offset ] self . stddayofweek = tup [ 2 + offset ] # Sunday=0 self . stdweeknumber = tup [ 3 + offset ] # Last = 5 self . stdhour = tup [ 4 + offset ] self . stdminute = tup [ 5 + offset ] tup = struct . unpack ( '=8h' , keydict [ 'DaylightStart' ] ) self . dstmonth = tup [ 1 + offset ] self . dstdayofweek = tup [ 2 + offset ] # Sunday=0 self . dstweeknumber = tup [ 3 + offset ] # Last = 5 self . dsthour = tup [ 4 + offset ] self . dstminute = tup [ 5 + offset ]