From: Stephen Seo Date: Mon, 24 Jun 2024 05:11:10 +0000 (+0900) Subject: Round percentage value X-Git-Tag: 0.4.12 X-Git-Url: https://git.seodisparate.com/stephenseo/LD53?a=commitdiff_plain;h=8e6305d9340136d6108a21028008afd51120f85c;p=mpd_info_screen Round percentage value --- diff --git a/src/display.rs b/src/display.rs index 0c57b46..09db043 100644 --- a/src/display.rs +++ b/src/display.rs @@ -55,7 +55,7 @@ fn seconds_to_time(seconds: f64) -> String { } fn time_to_percentage(total: f64, current: f64) -> String { - let result = (100.0f64 * current / total).to_string(); + let result = (100.0f64 * current / total).round().to_string(); match result.split_once('.') { Some((a, _)) => a.to_string() + "%", None => result + "%",