Created
April 13, 2019 19:18
-
-
Save cchandler/6dd1aa0c6c45dcd9be4b66af16b15124 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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