time::Duration::{milli}seconds now takes i64 arg

This commit is contained in:
Michael Gehring 2014-08-31 19:45:03 +02:00
parent cab466d678
commit cdacaaa648
2 changed files with 2 additions and 4 deletions

View file

@ -80,8 +80,7 @@ fn sleep(args: Vec<String>) {
let sleep_dur = if sleep_time == f64::INFINITY {
duration::MAX
} else {
let (days, secs, millis) = (sleep_time / 86400., sleep_time % 86400., (sleep_time * 1_000.) % 1_000.);
Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32)
Duration::seconds(sleep_time as i64)
};
timer::sleep(sleep_dur);
}

View file

@ -170,8 +170,7 @@ fn tail<T: Reader> (reader: &mut BufferedReader<T>, line_count:uint, follow:bool
// if we follow the file, sleep a bit and print the rest if the file has grown.
while follow {
let (days, secs, millis) = ((sleep_msec / 1000) / 86400, (sleep_msec / 1000) % 86400, sleep_msec % 1000);
sleep(Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32));
sleep(Duration::milliseconds(sleep_msec as i64));
for io_line in reader.lines() {
match io_line {
Ok(line) => print!("{}", line),