if elapsed:
    print('Elapsed time:', elapsed)
print(line)
print() 

def endlog():
    end = clock()
elapsed = end - start
log('End Program', secondsToStr(elapsed))

def now():
    return secondsToStr(clock())
start = clock()
atexit.register(endlog)
log('Start Program')
How to get time of a python program execution?