Spaces:
ahadi
/
Build error

3DFuse / my /utils /ticker.py
jyseo's picture
first commit
d661b19
raw
history blame
517 Bytes
from datetime import date, time, datetime, timedelta
from time import sleep
class IntervalTicker():
def __init__(self, interval=60):
self.interval = timedelta(seconds=interval)
self.last_tick = datetime.now()
self.now = self.last_tick
def tick(self):
self.now = datetime.now()
if (self.now - self.last_tick) > self.interval:
self.last_tick = self.now
return True
def tick_str(self):
return self.now.isoformat(timespec='seconds')