Author vstinner
Recipients germn, pitrou, r.david.murray, vstinner, yselivanov
Date 2017-09-21.16:07:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Clocks is a very complex topic, especially when you care of portability. See my PEP 418.

asyncio uses time.monotonic() clock to not be impacted when the system clock ("wall clock") is updated by the administrator or automatically by NTP.

On Windows, time.monotonic() is implemented with GetTickCount64() which has a bad resolution: around 15 ms. The exact resolution depends on the hardware.

See my PEP 418 which added time.monotonic() for Python 3.3 for much more information:

To get the clock resolution, use:

>>> import time; print(time.get_clock_info('monotonic'))

Example on Linux:

>>> import time; print(time.get_clock_info('monotonic'))
namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, resolution=1e-09)

Well, the announced resolution is 1 nanosecond, but in practice it's more around 500 ns. At least, it's better than 15 ms :-)


asyncio rounds timings using the clock resolution, time.get_clock_info('monotonic').resolution. Search for self._clock_resolution in Lib/asyncio/

asyncio is not designed for real time.
Date User Action Args
2017-09-21 16:07:58vstinnersetrecipients: + vstinner, pitrou, r.david.murray, yselivanov, germn
2017-09-21 16:07:58vstinnersetmessageid: <>
2017-09-21 16:07:58vstinnerlinkissue31539 messages
2017-09-21 16:07:58vstinnercreate