-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
Description
We currently manually format the elapsed time manually in the output log:
Lines 66 to 87 in 0f6efbd
fn format_elapsed(elapsed: Duration) -> String { | |
if elapsed.num_weeks() > 0 { | |
let h = elapsed.num_hours() % 24; | |
let d = elapsed.num_days() % 7; | |
let w = elapsed.num_weeks(); | |
format!("{} weeks {} days {}h", w, d, h) | |
} else if elapsed.num_days() > 0 { | |
let m = elapsed.num_minutes() % 60; | |
let h = elapsed.num_hours() % 24; | |
let d = elapsed.num_days(); | |
format!("{} days {}h {}min", d, h, m) | |
} else if elapsed.num_hours() > 0 { | |
let s = elapsed.num_seconds() % 60; | |
let m = elapsed.num_minutes() % 60; | |
let h = elapsed.num_hours(); | |
format!("{}h {}min {}s", h, m, s) | |
} else { | |
let s = elapsed.num_seconds() % 60; | |
let m = elapsed.num_minutes(); | |
format!("{}min {}s", m, s) | |
} | |
} |
This code could be replaced by using the humantime crate instead.