first implementations

This commit is contained in:
Thorben Wesche 2019-05-30 12:49:27 +02:00
parent 62a7778a97
commit ef252b6cd9
2 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,9 @@
def hoursSpent(t1, t2):
return 2
def hoursSpent(day_start, day_end, break_start, break_end):
duration_whole = day_end - day_start
print("duration_whole", duration_whole)
pause = break_end - break_start
print("pause", pause)
duration_without_pause = duration_whole - pause
return duration_without_pause

20
day.py
View File

@ -18,6 +18,24 @@ class Day:
self.begin = datetime.now()
print(self.begin)
def make_break(self):
self.begin_break = datetime.now()
def go_on(self):
self.end_break = datetime.now()
def endDay(self):
self.end = datetime.now()
self.duration = hoursSpent(self.begin, self.end)
self.duration = hoursSpent(
self.begin, self.end, self.begin_break, self.end_break)
first_day = Day()
first_day.beginDay()
sleep(1)
first_day.make_break()
sleep(2)
first_day.go_on()
sleep(10)
first_day.endDay()
print("worked", first_day.duration)