Python timer 模块,TimerEntry() 实例源码
我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用timer.TimerEntry()。
def __init__(self, begin, end, disabled = False, afterEvent = AFTEREVENT.NONE, timerType = TIMERTYPE.WAKEUP, checkOldTimers = False):
timer.TimerEntry.__init__(self, int(begin), int(end))
if checkOldTimers:
if self.begin < time() - 1209600:
self.begin = int(time())
if self.end < self.begin:
self.end = self.begin
self.dontSave = False
self.disabled = disabled
self.timer = None
self.__record_service = None
self.start_prepare = 0
self.timerType = timerType
self.afterEvent = afterEvent
self.autoincrease = False
self.autoincreasetime = 3600 * 24 # 1 day
self.autosleepinstandbyonly = 'no'
self.autosleepdelay = 60
self.autosleeprepeat = 'once'
self.log_entries = []
self.resetState()
def __init__(self, checkOldTimers = False, autosleepdelay = 60):
timer.TimerEntry.__init__(self, int(end))
if checkOldTimers:
if self.begin < time() - 1209600:
self.begin = int(time())
if self.end < self.begin:
self.end = self.begin
self.dontSave = False
self.disabled = disabled
self.timer = None
self.__record_service = None
self.start_prepare = 0
self.timerType = timerType
self.afterEvent = afterEvent
self.autoincrease = False
self.autoincreasetime = 3600 * 24 # 1 day
self.autosleepinstandbyonly = 'no'
self.autosleepdelay = autosleepdelay
self.autosleeprepeat = 'once'
self.autosleepwindow = 'no'
self.autosleepbegin = self.begin
self.autosleepend = self.end
self.nettraffic = 'no'
self.trafficlimit = 100
self.netip = 'no'
self.ipadress = "0.0.0.0"
self.log_entries = []
self.resetState()
self.messageBoxAnswerPending = False
#check autopowertimer
if (self.timerType == TIMERTYPE.AUTOSTANDBY or self.timerType == TIMERTYPE.AUTODEEPSTANDBY) and not self.disabled and time() > 3600 and self.begin > time():
self.begin = int(time()) #the begin is in the future -> set to current time = no start delay of this timer
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。