Skip to content

Instantly share code, notes, and snippets.

@cchandler
Created April 13, 2019 19:18
Show Gist options
  • Save cchandler/6dd1aa0c6c45dcd9be4b66af16b15124 to your computer and use it in GitHub Desktop.
Save cchandler/6dd1aa0c6c45dcd9be4b66af16b15124 to your computer and use it in GitHub Desktop.
extern crate clokwerk;
extern crate log;
use clokwerk::{Scheduler, TimeUnits};
use std::thread;
use std::time::Duration;
use log::{info, trace, warn};
fn main() {
simple_logger::init().unwrap();
info!("Starting Agent!");
let mut scheduler = Scheduler::new();
scheduler.every(3.seconds()).run(|| info!("Periodic task"));
loop {
scheduler.run_pending();
thread::sleep(Duration::from_millis(100));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment