#timer #alarm #schedule #chrono #chronometer

timer

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

8 releases

Uses old Rust 2015

0.2.0 Sep 11, 2017
0.1.6 Mar 11, 2016

#31 in Date and time

Download history 2616/week @ 2021-02-26 2596/week @ 2021-03-05 2306/week @ 2021-03-12 2744/week @ 2021-03-19 3128/week @ 2021-03-26 2039/week @ 2021-04-02 2842/week @ 2021-04-09 2859/week @ 2021-04-16 2641/week @ 2021-04-23 2681/week @ 2021-04-30 2723/week @ 2021-05-07 2520/week @ 2021-05-14 2519/week @ 2021-05-21 2389/week @ 2021-05-28 2073/week @ 2021-06-04 2084/week @ 2021-06-11

11,165 downloads per month
Used in 91 crates (15 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

~1MB
~12K SLoC