In Python 3.4.1, I am trying to measure how long it takes to start and end a function and then write. I am doing it like this:
starttime = time.clock() asyncio.wait_for((method()), 5) endtime = time.clock() print(endtime - starttime)
This usually causes Python to spit out something around 6.29989986222767E-06 (or 0.00000629989986222767E). Then I tried this with time.sleep:
starttime = time.clock() asyncio.wait_for((time.sleep(3)), 5) endtime = time.clock() print(endtime - starttime)
This again led to 6.87261802845284E-06, although (at least I think) it will take 3 seconds. I tried this with threads, with the same result. What do you think? How can I determine how long it takes to start and end a function?
Xanco source share