-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.py
More file actions
30 lines (24 loc) · 829 Bytes
/
Copy pathtimer.py
File metadata and controls
30 lines (24 loc) · 829 Bytes
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
import time
from random import randint
class Timer:
def __init__(self):
self.start = time.time()
def restart(self):
self.start = time.time()
def get_time_hhmmss(self):
end = time.time()
m, s = divmod(end - self.start, 60)
h, m = divmod(m, 60)
time_str = "%02d:%02d:%02d" % (h, m, s)
return time_str
class Timestamp:
def __init__(self):
self.startTime = 1262304000
self.currentTime = int(time.time())
def random(self):
randomTime = randint(self.startTime, self.currentTime)
return randomTime
def displayTimer(time, timerType):
print("=====================================================")
print("Total {} Time = {}".format(timerType, time))
print("=====================================================")