File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -128,9 +128,11 @@ battery_fill_info(struct battery_info *i)
128128 }
129129
130130 i -> state = NO_BATTERY ; /* assume we're just plugged in. */
131- i -> seconds = -1 ;
132- i -> fraction = -1 ;
133- i -> voltage = -1 ;
131+ i -> seconds = NAN ;
132+ i -> fraction = NAN ;
133+ i -> voltage = NAN ;
134+ i -> current = NAN ;
135+ i -> temperature = NAN ;
134136
135137 while ((dent = readdir (dirp )) != NULL ) {
136138 const char * name = dent -> d_name ;
@@ -213,8 +215,8 @@ battery_fill_info(struct battery_info *i)
213215 * (failing a report of minutes, we'll take the highest percent.)
214216 */
215217
216- if ((secs < 0 ) && (i -> seconds < 0 )) {
217- if ((pct < 0 ) && (i -> fraction < 0 )) {
218+ if ((secs < 0 ) && (isnan ( i -> seconds ) )) {
219+ if ((pct < 0 ) && (isnan ( i -> fraction ) )) {
218220 choose = true; /* at least we know there's a battery. */
219221 } else if (pct > i -> fraction * 100 ) {
220222 choose = true;
You can’t perform that action at this time.
0 commit comments