#tokio #intervals #timing #async-task #timestamp #waiting #min

async_timing_util

tokio async functions for waiting until even intervals (on 1 min, 5 min, 30 min, etc), or waiting until a specified timestamp

16 releases (1 stable)

1.0.0 Jul 3, 2024
0.1.14 Jan 18, 2023
0.1.12 Dec 11, 2022
0.1.11 Nov 1, 2022
0.1.2 Sep 19, 2022

#1531 in Asynchronous

Download history 75/week @ 2024-10-26 68/week @ 2024-11-02 18/week @ 2024-11-09 60/week @ 2024-11-16 50/week @ 2024-11-23 31/week @ 2024-11-30 43/week @ 2024-12-07 45/week @ 2024-12-14 2/week @ 2024-12-21 3/week @ 2024-12-28 20/week @ 2025-01-04 17/week @ 2025-01-11 13/week @ 2025-01-18 37/week @ 2025-01-25 143/week @ 2025-02-01 102/week @ 2025-02-08

296 downloads per month
Used in 8 crates (6 directly)

MIT license

8KB
163 lines

Async Timing Util

Convenient utilities for doing repeated tasks at precise intervals.

use async_timing_util::{Timelength, wait_until_timelength};

loop {
    let ts = wait_until_timelength(Timelength::OneHour, 0).await;
    /// Do something async every hour, on the hour.
		/// Runs at 00:00, 01:00, 02:00, etc.
}

lib.rs:

Async Timing Util

Convenient utilities for doing repeated tasks at precise intervals.

use async_timing_util::{Timelength, wait_until_timelength};

loop {
    let ts = wait_until_timelength(Timelength::OneHour).await;
    /// Do something async every hour, on the hour
    /// Runs at 00:00, 01:00, 02:00, etc.
}

Dependencies

~2.3–8.5MB
~68K SLoC