-
Notifications
You must be signed in to change notification settings - Fork 0
/
func.py
55 lines (42 loc) · 1.09 KB
/
func.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
48
49
50
51
52
53
54
55
def addZero(n, z = 2):
return str(n).zfill(z)
def clockString(ms, v2 = False):
if v2 == True:
ss = int(str(ms).split(".")[0])
if str(ms / 3600).find("-") != -1:
hh = 0
else:
hh = int(str(ms / 3600).split(".")[0])
if str(ms / 60).find("-") != -1:
mm = 0
else:
mm = int(str(ms / 60).split(".")[0]) % 60
if str(ms / 60).find("-") != -1:
ss = 0
else:
ss = int(str(ms).split(".")[0]) % 60
ms = ms % 1000
hh = addZero(hh)
mm = addZero(mm)
ss = addZero(ss)
return hh + ":" + mm + ":" + ss
else:
ms = int(str(ms).split(".")[0])
if str(ms / 3600000).find("-") != -1:
hh = 0
else:
hh = int(str(ms / 3600000).split(".")[0])
if str(ms / 60000).find("-") != -1:
mm = 0
else:
mm = int(str(ms / 60000).split(".")[0]) % 60
if str(ms / 1000).find("-") != -1:
ss = 0
else:
ss = int(str(ms / 1000).split(".")[0]) % 60
ms = ms % 1000
hh = addZero(hh)
mm = addZero(mm)
ss = addZero(ss)
ms = addZero(ms, 4)
return hh + ":" + mm + ":" + ss + " " + ms