]> git.sur5r.net Git - i3/i3status/commitdiff
Changed battery info output to HH:MM for consistency accross all platforms 26/head
authorNicholas Helke <nhelke@gmail.com>
Thu, 16 Apr 2015 20:58:40 +0000 (21:58 +0100)
committerNicholas Helke <nicholas.helke@kaldorgroup.com>
Tue, 5 May 2015 09:51:57 +0000 (10:51 +0100)
src/print_battery_info.c

index 1126f5712fe03586b3ccdccb18d51d9493228061..85b0a75a5d097d369d956162e80628bc5a3436ce 100644 (file)
@@ -245,7 +245,7 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char
         minutes = remaining;
         hours = minutes / 60;
         minutes -= (hours * 60);
-        (void)snprintf(remainingbuf, sizeof(remainingbuf), "%02dh%02d",
+        (void)snprintf(remainingbuf, sizeof(remainingbuf), "%02d:%02d",
                        max(hours, 0), max(minutes, 0));
         if (strcasecmp(threshold_type, "percentage") == 0 && present_rate < low_threshold) {
             START_COLOR("color_bad");
@@ -310,7 +310,7 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char
 
     /* Can't give a meaningful value for remaining minutes if we're charging. */
     if (status != CS_CHARGING) {
-        (void)snprintf(remainingbuf, sizeof(remainingbuf), "%d", apm_info.minutes_left);
+        (void)snprintf(remainingbuf, sizeof(remainingbuf), "%02d:%02d", apm_info.minutes_left / 60, apm_info.minutes_left % 60);
     } else {
         (void)snprintf(remainingbuf, sizeof(remainingbuf), "%s", "(CHR)");
     }