#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

#1137 in Asynchronous

Download history 99/week @ 2024-07-22 55/week @ 2024-07-29 84/week @ 2024-08-05 107/week @ 2024-08-12 36/week @ 2024-08-19 50/week @ 2024-08-26 30/week @ 2024-09-02 68/week @ 2024-09-09 29/week @ 2024-09-16 66/week @ 2024-09-23 107/week @ 2024-09-30 115/week @ 2024-10-07 106/week @ 2024-10-14 88/week @ 2024-10-21 65/week @ 2024-10-28 64/week @ 2024-11-04

351 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.4–8.5MB
~69K SLoC