The unified diff between revisions [f423db7e..] and [22b150e2..] is displayed below. It can also be downloaded as a raw diff.

#
#
# patch "acpi.c"
#  from [8b6578bc69b33739e78bdb626ad64efdd62867fb]
#    to [6037aa3f0934d1c667623d425ccc47befe0c9ba2]
#
============================================================
--- acpi.c	8b6578bc69b33739e78bdb626ad64efdd62867fb
+++ acpi.c	6037aa3f0934d1c667623d425ccc47befe0c9ba2
@@ -277,7 +277,7 @@ void print_battery_information(struct li
 		int hours, minutes, seconds;
 		int found_fields = 0;
 		double pct = 0;
-	int percentage;
+		int percentage;
 		char *state = NULL, *poststr;

 		fields = battery->data;
@@ -293,7 +293,7 @@ void print_battery_information(struct li
 				design_capacity = get_unit_value(value->value);
 				found_fields++;
 			} else if (!strcmp(value->attr, "charging state") ||
-					!strcmp(value->attr, "State")) {
+				   !strcmp(value->attr, "State")) {
 				state = value->value;
 				found_fields++;
 			}
@@ -303,7 +303,7 @@ void print_battery_information(struct li
 			}
 			fields = list_next(fields);
 		}
-		if (remaining_capacity < 0 || present_rate < 0 || design_capacity < 0 || !state) {
+		if (remaining_capacity < 0 || design_capacity < 0 || !state) {
 			if (show_empty_slots) {
 				printf("%12s %d: slot empty\n", BATTERY_DESC, battery_num);
 			}
@@ -313,15 +313,19 @@ void print_battery_information(struct li
 			} else {
 				pct = (double)remaining_capacity / design_capacity;
 			}
-		percentage = pct * 100;
-		if (percentage > 100)
-			percentage = 100;
+			percentage = pct * 100;
+			if (percentage > 100)
+				percentage = 100;
 			printf("%12s %d: %s, %d%%", BATTERY_DESC, battery_num, state, percentage);
-			if (!strcmp(state, "charging")) {
+			if (present_rate == -1) {
+				poststr = "rate information unavailable.";
+				seconds = -1;
+			} else if (!strcmp(state, "charging")) {
 				if (present_rate > MIN_PRESENT_RATE) {
 					seconds = 3600 * (double)(design_capacity - remaining_capacity) / present_rate;
 					poststr = " until charged";
 				} else {
+					poststr = "charging at zero rate - will never fully charge.";
 					seconds = -1;
 				}
 			} else if (!strcmp(state, "discharging")) {
@@ -337,7 +341,7 @@ void print_battery_information(struct li
 				seconds -= 60 * minutes;
 				printf(", %02d:%02d:%02d%s", hours, minutes, seconds, poststr);
 			} else if (seconds < 0) {
-				printf(", charging at zero rate - will never fully charge.");
+				printf(", %s", poststr);
 			}
 			printf("\n");
 		}