mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-13 12:44:34 +03:00
Update battery API to use NAN on error
This commit is contained in:
@ -15,6 +15,7 @@ This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com).
|
||||
#include "StringUtils.h"
|
||||
#include "Platform.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -29,8 +30,8 @@ static void BatteryMeter_updateValues(Meter * this, char *buffer, int len) {
|
||||
|
||||
Battery_getData(&percent, &isOnAC);
|
||||
|
||||
if (percent == -1) {
|
||||
this->values[0] = 0;
|
||||
if (isnan(percent)) {
|
||||
this->values[0] = NAN;
|
||||
xSnprintf(buffer, len, "n/a");
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user