From 1bf9a767c25fb303563abf51f7e2b35efe7744f0 Mon Sep 17 00:00:00 2001 From: Unia Date: Sat, 15 Feb 2014 18:14:07 +0100 Subject: [PATCH] added hours check --- dwmst.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dwmst.c b/dwmst.c index 4c4a313..3de7cb7 100644 --- a/dwmst.c +++ b/dwmst.c @@ -151,11 +151,13 @@ get_batt(void) { if(strncmp(state, "Charging", 8) == 0) { minutes = 60 * ((full - now) / rate); hours = minutes / 60; + if(hours > 24) hours = 24; minutes -= 60 * hours; return smprintf(BAT_CHRG_STR, perc, hours, minutes); } else { minutes = 60 * (now / rate); hours = minutes / 60; + if(hours > 24) hours = 24; minutes -= 60 * hours; /*notify*/ return smprintf(BAT_DIS_STR, perc, hours, minutes);