Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Commit

Permalink
added hours check
Browse files Browse the repository at this point in the history
  • Loading branch information
Unia committed Feb 15, 2014
1 parent e41f6a8 commit 1bf9a76
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dwmst.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1bf9a76

Please sign in to comment.