summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRupert Rutledge <eosis2 [at] gmail.com>2020-05-09 17:24:13 +0100
committerRupert Rutledge <eosis2 [at] gmail.com>2020-05-09 17:24:13 +0100
commite17f8e624299463fe1174f55264df39569e83863 (patch)
treef179f72cfcdd38f7c2001539ad53388f54700160 /src
parent53b80c7175a42dc5dd4b6b3ead65fc107c2f532e (diff)
Add days to the duration print
Diffstat (limited to 'src')
-rw-r--r--src/display/components/total_bandwidth.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/display/components/total_bandwidth.rs b/src/display/components/total_bandwidth.rs
index 8a16b3e..93e8671 100644
--- a/src/display/components/total_bandwidth.rs
+++ b/src/display/components/total_bandwidth.rs
@@ -59,9 +59,17 @@ impl<'a> HeaderDetails<'a> {
}
fn render_elapsed_time(&self, frame: &mut Frame<impl Backend>, rect: Rect, color: &Color) {
+ const SECONDS_IN_DAY: u64 = 86400;
+ let plural = if self.elapsed_time.as_secs() / SECONDS_IN_DAY == 1 {
+ ""
+ } else {
+ "s"
+ };
let elapsed_time_text = [Text::styled(
format!(
- "Duration: {:02}:{:02}:{:02} ",
+ "{:01} day{}, {:02}:{:02}:{:02} ",
+ self.elapsed_time.as_secs() / SECONDS_IN_DAY,
+ plural,
self.elapsed_time.as_secs() / 3600,
(self.elapsed_time.as_secs() % 3600) / 60,
self.elapsed_time.as_secs() % 60