Fixed negative sleep_time error
This commit is contained in:
parent
94591ec51e
commit
319e6947b1
1 changed files with 16 additions and 11 deletions
|
@ -1,5 +1,7 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
min_sleep_minutes = 0
|
||||
|
||||
class LoopTimer (object):
|
||||
"""Manages loop times and sleeps until
|
||||
next loop."""
|
||||
|
@ -36,6 +38,9 @@ class LoopTimer(object):
|
|||
time_until_hour = self.get_time_to_next_hour()
|
||||
if time_until_hour < sleep_time:
|
||||
return time_until_hour
|
||||
|
||||
if sleep_time < timedelta(0):
|
||||
sleep_time = timedelta(0, 0, 0, 0, min_sleep_minutes)
|
||||
return sleep_time
|
||||
|
||||
def get_last_duration (self):
|
||||
|
|
Loading…
Reference in a new issue