//! sleep N -- wait N seconds (or `sleep 250ms`). The kernel blocks the //! thread until the timer says it's time; no CPU is used meanwhile. #![no_std] #![no_main] extern crate ulib; ulib::entry!(main); use ulib::*; fn main() -> i64 { let a = arg(1).unwrap_or(""); let ms = match a.strip_suffix("ms") { Some(n) => n.parse::().ok(), None => a.parse::().ok().map(|s| s * 1000), }; match ms { Some(ms) => { sleep_ms(ms); 0 } None => { eprintln!("usage: sleep seconds | sleep 250ms"); 2 } } }