#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

#27 in Date and time

Download history 1480/week @ 2019-03-28 1442/week @ 2019-04-04 1217/week @ 2019-04-11 1234/week @ 2019-04-18 790/week @ 2019-04-25 705/week @ 2019-05-02 942/week @ 2019-05-09 903/week @ 2019-05-16 875/week @ 2019-05-23 968/week @ 2019-05-30 861/week @ 2019-06-06 1041/week @ 2019-06-13 778/week @ 2019-06-20 801/week @ 2019-06-27 673/week @ 2019-07-04

4,718 downloads per month
Used in 12 crates (8 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
~11K SLoC