-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendTimes.py
47 lines (34 loc) · 1.76 KB
/
endTimes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python3
import datetime
import variables
# Calculates the end time of the current work phase
def endTimeWork():
now = datetime.datetime.now()
delta = datetime.timedelta(minutes=variables.workDuration)
t = now.time()
combined = ((datetime.datetime.combine(datetime.date(1, 1, 1), t) + delta).time()) # Adds workDuration to the current time
combinedCut = combined.replace(second=0, microsecond=0) # Cuts out seconds and microseconds for better readibility
return combinedCut
# Calculates the end time of the current short pause
def endTimeShortPause():
now = datetime.datetime.now()
delta = datetime.timedelta(minutes=variables.shortPauseDuration)
t = now.time()
combined = ((datetime.datetime.combine(datetime.date(1, 1, 1), t) + delta).time()) # Adds shortPauseDuration to the current time
combinedCut = combined.replace(second=0, microsecond=0) # Cuts out seconds and microseconds for better readibility
return combinedCut
# Calculates the end time of the current long pause
def endTimeLongPause():
now = datetime.datetime.now()
delta = datetime.timedelta(minutes=variables.longPauseDuration)
t = now.time()
combined = ((datetime.datetime.combine(datetime.date(1, 1, 1), t) + delta).time()) # Adds longPauseDuration to the current time
combinedCut = combined.replace(second=0, microsecond=0) # Cuts out seconds and microseconds for better readibility
return combinedCut
# These Messages are displayed in pomodoro.py
def workTimeMessage():
return("This work phase will end at {}".format(endTimeWork()))
def shortPauseTimeMessage():
return("Your pause will end at {}".format(endTimeShortPause()))
def longPauseTimeMessage():
return("Your pause will end at {}".format(endTimeLongPause()))