first implementations
This commit is contained in:
parent
62a7778a97
commit
ef252b6cd9
@ -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
20
day.py
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user