Refactor time_to_percentage(...)
This commit is contained in:
parent
8e6305d934
commit
8ebeac0499
1 changed files with 1 additions and 5 deletions
|
@ -55,11 +55,7 @@ fn seconds_to_time(seconds: f64) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn time_to_percentage(total: f64, current: f64) -> String {
|
fn time_to_percentage(total: f64, current: f64) -> String {
|
||||||
let result = (100.0f64 * current / total).round().to_string();
|
((100.0f64 * current / total).round() as i32).to_string() + "%"
|
||||||
match result.split_once('.') {
|
|
||||||
Some((a, _)) => a.to_string() + "%",
|
|
||||||
None => result + "%",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "unicode_support"))]
|
#[cfg(not(feature = "unicode_support"))]
|
||||||
|
|
Loading…
Reference in a new issue