from datetime import datetime
startTime = datetime.now()
#do something
#Python 2:
print datetime.now() - startTime
#Python 3:
print(datetime.now() - startTime)
import schedule
import time
def job(t):
print "I'm working...", t
return
schedule.every().day.at("01:00").do(job,'It is 01:00')
while True:
schedule.run_pending()
time.sleep(60) # wait one minute
#its tricky and so much easy
#python execute time counter
#coded by Luban
import time
start_time = time.time()
while True:
x = time.time() - start_time
x = int(x)
print('Current Time = ',str(x))
from datetime import datetime
from threading import Timer
x=datetime.today()
y=x.replace(day=x.day+1, hour=1, minute=0, second=0, microsecond=0)
delta_t=y-x
secs=delta_t.seconds+1
def hello_world():
print "hello world"
#...
t = Timer(secs, hello_world)
t.start()