<s> """<STR_LIT>""" <EOL> import time as time_mod <EOL> originals = { name : getattr ( time_mod , name ) for name in <EOL> [ '<STR_LIT:time>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] } <EOL> epoch = None <EOL> def reset ( seconds = None ) : <EOL> """<STR_LIT>""" <EOL> global epoch <EOL> epoch = seconds if seconds is not None else originals [ '<STR_LIT:time>' ] ( ) <EOL> reset ( ) <EOL> def time ( ) : <EOL> return epoch <EOL> def sleep ( seconds ) : <EOL> global epoch <EOL> epoch += seconds <EOL> def gmtime ( seconds = None ) : <EOL> return originals [ '<STR_LIT>' ] ( seconds if seconds is not None else epoch ) <EOL> def localtime ( seconds = None ) : <EOL> return originals [ '<STR_LIT>' ] ( seconds if seconds is not None else epoch ) <EOL> def ctime ( seconds = None ) : <EOL> return originals [ '<STR_LIT>' ] ( seconds if seconds is not None else epoch ) <EOL> def asctime ( t = None ) : <EOL> return originals [ '<STR_LIT>' ] ( t if t is not None else localtime ( ) ) <EOL> def strftime ( format , t = None ) : <EOL> return originals [ '<STR_LIT>' ] ( format , t if t is not None else localtime ( ) ) <EOL> def monkey_patch ( ) : <EOL> """<STR_LIT>""" <EOL> reset ( ) <EOL> time_mod . time = time <EOL> time_mod . sleep = sleep <EOL> time_mod . gmtime = gmtime <EOL> time_mod . localtime = localtime <EOL> time_mod . ctime = ctime <EOL> time_mod . asctime = asctime <EOL> time_mod . strftime = strftime <EOL> def monkey_restore ( ) : <EOL> """<STR_LIT>""" <EOL> for k , v in originals . items ( ) : <EOL> setattr ( time_mod , k , v ) <EOL> global epoch <EOL> epoch = None </s>
