summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@users.noreply.github.com>2015-05-05 11:19:42 -0700
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2015-05-05 11:19:42 -0700
commitf8c11c31b2f8b98d8b879c446da0c7860e703beb (patch)
treed71e8ea330aee7201ab5f153b25bbb9ea01d46b4
parent96e36117e3195fafbeea38de6f49a6050c7c3463 (diff)
parentd7f0d64c4012cdbb8deb47f16bd8f62bebf2fdc2 (diff)
Merge pull request #26 from nhelke/master
Changed battery info output to HH:MM for consistency accross all platforms
-rw-r--r--src/print_battery_info.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/print_battery_info.c b/src/print_battery_info.c
index 1126f57..85b0a75 100644
--- a/src/print_battery_info.c
+++ b/src/print_battery_info.c
@@ -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)");
}