7 releases

0.1.6 Oct 10, 2024
0.1.5 Oct 9, 2024

#607 in Asynchronous

29 downloads per month

BSL-1.0 license

32KB
781 lines

Hires timers for tokio.

This is a drop-in replacement of tokio::time. The API is a 1:1 replication. Please refer to the doc there. Timers with the highest possible resolution from the operating system are used. The feature time of tokio is not used and is not required. Sub-millisecond granularity is achieved with:

  • timerfd in Linux (and Android).
  • kqueue with EVFILT_TIMER in *BSD and Apple's Darwin; specifically, NOTE_MACHTIME is used in Darwin to obtain the similar resolution to GCD.
  • CreateWaitableTimerEx with CREATE_WAITABLE_TIMER_HIGH_RESOLUTION in Windows.

lib.rs:

Hires timers for tokio.

This is a drop-in replacement of tokio::time. The API is a 1:1 replication. Please refer to the doc there.

Timers with the highest possible resolution from the operating system are used. The feature time of tokio is not used and is not required. Sub-millisecond granularity is achieved with:

  • timerfd in Linux (and Android).
  • kqueue with EVFILT_TIMER in *BSD and Apple's Darwin; specifically, NOTE_MACHTIME is used in Darwin to obtain the similar resolution to GCD.
  • CreateWaitableTimerEx with CREATE_WAITABLE_TIMER_HIGH_RESOLUTION in Windows.

Dependencies

~2–41MB
~617K SLoC