forked from gqdw/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimelog.py
38 lines (32 loc) · 1019 Bytes
/
timelog.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
#import datetime
from datetime import datetime, timedelta
import time
class timelog:
# start_time = datetime.now()
def __init__(self):
self.start_time = datetime.now()
print "class timelog is active."
#print "will sleep 4"
#time.sleep(4)
def end(self):
self.end_time = datetime.now()
def p(self):
print "past %d microseconds\n" % ((self.end_time - self.start_time).microseconds)
#print "past %d seconds\n" % ((self.end_time - self.start_time).seconds)
tl = timelog()
time.sleep(3)
tl.end()
tl.p()
#delta = end_time - start_time
#print "past %d seconds\n" % delta.seconds
#def days_hours_minutes_seconds(timedelta):
# minutes = (timedelta.seconds//60)%60
# r_seconds = timedelta.seconds - (minutes * 60)
# return timedelta.days, timedelta.seconds//3600, minutes, r_seconds
#
#def playbook_on_stats():
#
# end_time = datetime.now()
# timedelta = end_time - start_time
# print "Playbook run took %s days, %s hours, %s minutes, %s seconds" % (days_hours_minutes_seconds(timedelta))
#playbook_on_stats()