Asynchronous Timer Library

atimer library implements asynchronous timer Python coroutine based on POSIX timers. The coroutine can be used with Python asyncio module API.

The main features of the timer implemented by the library are

  • expires at regular intervals

  • allows to track number of expirations if a long running task causes overrun

  • starts synchronized with system clock at the edge of an interval

  • measures time while system is suspended

The library is tested with default asyncio event loop and its drop-in replacement uvloop. Use of uvloop increases timer accuracy.

Requirements

  • Python 3.11 or later

  • Cython 3.0.0 or later

The atimer library is licensed under terms of GPL license, version 3, see COPYING file for details.

Note

The library is implemented on top of timerfd Linux kernel interface and uses CLOCK_BOOTTIME clock by default.