#timer #schedule #chrono #alarm #chronometer

timer

A simple timer. Use it to schedule execution of closures after a delay or at a given timestamp.

8 releases

0.2.0 Sep 11, 2017
0.1.6 Mar 11, 2016

#19 in Date and time

Download history 712/week @ 2019-10-13 660/week @ 2019-10-20 660/week @ 2019-10-27 690/week @ 2019-11-03 731/week @ 2019-11-10 1783/week @ 2019-11-17 2140/week @ 2019-11-24 945/week @ 2019-12-01 843/week @ 2019-12-08 886/week @ 2019-12-15 449/week @ 2019-12-22 704/week @ 2019-12-29 616/week @ 2020-01-05 728/week @ 2020-01-12 816/week @ 2020-01-19

4,000 downloads per month
Used in 21 crates (9 directly)

MPL-2.0 license

30KB
414 lines

Timer

Build Status

Simple implementation of a Timer in and for Rust.

Example

extern crate timer;
extern crate chrono;
use std::sync::mpsc::channel;

let timer = timer::Timer::new();
let (tx, rx) = channel();

timer.schedule_with_delay(chrono::Duration::seconds(3), move || {
  tx.send(()).unwrap();
});

rx.recv().unwrap();
println!("This code has been executed after 3 seconds");

lib.rs:

A simple timer, used to enqueue operations meant to be executed at a given time or after a given delay.

Dependencies

~765KB
~10K SLoC