19 lines
538 B
Python
19 lines
538 B
Python
from datetime import timedelta, datetime
|
|
|
|
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
|
|
print("Going to finish in {}".format(ft.strftime("%d/%m @ %H:%M")))
|
|
|