Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import time
>>> time.time() - time.time()
0.0
Why is this the case? From my simple understanding, this function returns the system clock in seconds since the epoch at the exact time of the call. But shouldn't the two calls to time.time() return slightly different floats?
The resolution of the timer isn't unlimited; it goes up by small amounts periodically. If the two calls are close enough together, you will see a zero value. If you tried a large number of such calls, you would probably find that the difference is zero most of the time, and some number of microseconds the rest of the time, depending on your particular system's speed, hardware details, and kernel implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With