I have a command line program in Python that takes a while to finish. I want to know the exact time it takes to finish running.
I\'ve looked at the timeit
timeit
To use metakermit's updated answer for Python 2.7, you will require the monotonic package.
The code would then be as follows:
from datetime import timedelta from monotonic import monotonic start_time = monotonic() end_time = monotonic() print(timedelta(seconds=end_time - start_time))