<s> from datetime import tzinfo , timedelta , datetime <EOL> import time as _time <EOL> class SgTimezone ( object ) : <EOL> '''<STR_LIT>''' <EOL> ZERO = timedelta ( <NUM_LIT:0> ) <EOL> STDOFFSET = timedelta ( seconds = - _time . timezone ) <EOL> if _time . daylight : <EOL> DSTOFFSET = timedelta ( seconds = - _time . altzone ) <EOL> else : <EOL> DSTOFFSET = STDOFFSET <EOL> DSTDIFF = DSTOFFSET - STDOFFSET <EOL> def __init__ ( self ) : <EOL> self . utc = UTC ( ) <EOL> self . local = LocalTimezone ( ) <EOL> @ classmethod <EOL> def UTC ( cls ) : <EOL> '''<STR_LIT>''' <EOL> return UTC ( ) <EOL> @ classmethod <EOL> def LocalTimezone ( cls ) : <EOL> '''<STR_LIT>''' <EOL> return LocalTimezone ( ) <EOL> class UTC ( tzinfo ) : <EOL> '''<STR_LIT>''' <EOL> def utcoffset ( self , dt ) : <EOL> return SgTimezone . ZERO <EOL> def tzname ( self , dt ) : <EOL> return "<STR_LIT>" <EOL> def dst ( self , dt ) : <EOL> return SgTimezone . ZERO <EOL> class LocalTimezone ( tzinfo ) : <EOL> '''<STR_LIT>''' <EOL> def utcoffset ( self , dt ) : <EOL> '''<STR_LIT>''' <EOL> if self . _isdst ( dt ) : <EOL> return SgTimezone . DSTOFFSET <EOL> else : <EOL> return SgTimezone . STDOFFSET <EOL> def dst ( self , dt ) : <EOL> '''<STR_LIT>''' <EOL> if self . _isdst ( dt ) : <EOL> return SgTimezone . DSTDIFF <EOL> else : <EOL> return SgTimezone . ZERO <EOL> def tzname ( self , dt ) : <EOL> '''<STR_LIT>''' <EOL> return _time . tzname [ self . _isdst ( dt ) ] <EOL> def _isdst ( self , dt ) : <EOL> '''<STR_LIT>''' <EOL> tt = ( dt . year , dt . month , dt . day , dt . hour , dt . minute , dt . second , dt . weekday ( ) , <NUM_LIT:0> , - <NUM_LIT:1> ) <EOL> stamp = _time . mktime ( tt ) <EOL> tt = _time . localtime ( stamp ) <EOL> return tt . tm_isdst > <NUM_LIT:0> </s>
