minuteurs 1.0.1

A small crate to sync threads on periodic events
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::time::{Duration, Instant};

use minuteurs::Deadline;

fn main() {
    let mut deadline = Deadline::once(Duration::from_secs(1));
    let now = Instant::now();

    std::thread::sleep(Duration::from_millis(750));

    deadline.wait();

    let elapsed = now.elapsed();
    assert!(elapsed > Duration::from_secs(1));
    println!("elapsed: {elapsed:?}");
}