diff --git a/calculation.py b/calculation.py index 5a3bbb3..0223378 100644 --- a/calculation.py +++ b/calculation.py @@ -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 diff --git a/day.py b/day.py index f5e8c12..2ac16d6 100644 --- a/day.py +++ b/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)