Use the loop clock for scheduling and deadlines.
Section: Getting Started
Get the running loop and monotonic time
python
python
import asyncio
async def main():
loop = asyncio.get_running_loop()
start = loop.time()
await asyncio.sleep(0.5)
print(loop.time() - start)
asyncio.run(main())Explanation
Use `loop.time()` for deadlines and timeouts instead of wall-clock time.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Getting Started
Run an async entrypoint
Execute a top-level coroutine and manage the event loop automatically.
Use asyncio.Runner for multiple async calls
Reuse a managed loop for multiple top-level async calls.