It just prints the time from the time you start the program in python.
test.py
#-*- using:utf-8 -*-
import time
if __name__ == '__main__':
start_time = time.time()
while True:
time.sleep(1);
elapsed_time = time.time() - start_time
print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
Execution result
$ python3 test.py
elapsed_time:1.0001800060272217[sec]
elapsed_time:2.0004279613494873[sec]
elapsed_time:3.0007290840148926[sec]
elapsed_time:4.001792907714844[sec]
elapsed_time:5.0019917488098145[sec]
time --- Accessing and converting time data
Recommended Posts