mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 09:27:21 +00:00
time::Duration::{milli}seconds now takes i64 arg
This commit is contained in:
parent
cab466d678
commit
cdacaaa648
2 changed files with 2 additions and 4 deletions
|
@ -80,8 +80,7 @@ fn sleep(args: Vec<String>) {
|
||||||
let sleep_dur = if sleep_time == f64::INFINITY {
|
let sleep_dur = if sleep_time == f64::INFINITY {
|
||||||
duration::MAX
|
duration::MAX
|
||||||
} else {
|
} else {
|
||||||
let (days, secs, millis) = (sleep_time / 86400., sleep_time % 86400., (sleep_time * 1_000.) % 1_000.);
|
Duration::seconds(sleep_time as i64)
|
||||||
Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32)
|
|
||||||
};
|
};
|
||||||
timer::sleep(sleep_dur);
|
timer::sleep(sleep_dur);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
// if we follow the file, sleep a bit and print the rest if the file has grown.
|
||||||
while follow {
|
while follow {
|
||||||
let (days, secs, millis) = ((sleep_msec / 1000) / 86400, (sleep_msec / 1000) % 86400, sleep_msec % 1000);
|
sleep(Duration::milliseconds(sleep_msec as i64));
|
||||||
sleep(Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32));
|
|
||||||
for io_line in reader.lines() {
|
for io_line in reader.lines() {
|
||||||
match io_line {
|
match io_line {
|
||||||
Ok(line) => print!("{}", line),
|
Ok(line) => print!("{}", line),
|
||||||
|
|
Loading…
Reference in a new issue