Created
August 2, 2016 06:02
-
-
Save z3t0/61d615fcb47c9cf547e91fc54b4019bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Nolag Server : Main | |
| // Rafi Khan | |
| extern crate time; | |
| use std::thread::sleep; | |
| use std::time::Duration; | |
| // runs loop update_rate times a second | |
| fn main() { | |
| let now = time::precise_time_s(); | |
| let update_rate = 50000000; // every 50ms | |
| loop { | |
| let start = time::precise_time_ns(); | |
| println!("Time : {}", time::precise_time_s() - now); | |
| sleep(Duration::new(0, (start + update_rate - time::precise_time_ns()) as u32)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment