You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from datetime import timedelta, datetime
|
|
|
|
import logging
|
|
|
|
|
|
|
|
class TimeInfo:
|
|
|
|
def __init__(self, to_go):
|
|
|
|
self.times = []
|
|
|
|
self.to_go = to_go
|
|
|
|
|
|
|
|
def add_measurement(self, time_measurement):
|
|
|
|
if time_measurement > 0:
|
|
|
|
self.times.append(time_measurement)
|
|
|
|
self.to_go -= 1
|
|
|
|
|
|
|
|
def info(self):
|
|
|
|
seconds = sum(self.times) / len(self.times)
|
|
|
|
td = timedelta(seconds = int(seconds * self.to_go))
|
|
|
|
ft = datetime.now() + td
|
|
|
|
logging.info("Going to finish in {}".format(ft.strftime("%d/%m @ %H:%M")))
|
|
|
|
|