cpuTemperature() fix NaN issue (windows)

This commit is contained in:
Sebastian Hildebrandt 2022-03-10 20:58:39 +01:00
parent 704c1aff5a
commit 694ab9e98f
4 changed files with 12 additions and 4 deletions

View File

@ -80,6 +80,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.11.7 | 2022-03-10 | `cpuTemperature()` fi NaN issue (windows) |
| 5.11.6 | 2022-03-01 | typescript typings fix `diskLayout()` |
| 5.11.5 | 2022-02-26 | fixed parsing issues (windows) |
| 5.11.4 | 2022-02-20 | `powerShell` execution policy fix (windows) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.11.7</th>
<td>2022-03-10</td>
<td><span class="code">cpuTemperature()</span> fix NaN issue (windows)</td>
</tr>
<tr>
<th scope="row">5.11.6</th>
<td>2022-03-01</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.11.6</span></div>
<div class="version">New Version: <span id="version">5.11.7</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -1192,9 +1192,11 @@ function cpuTemperature(callback) {
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
lines.forEach(function (line) {
let value = (parseInt(line, 10) - 2732) / 10;
sum = sum + value;
if (value > result.max) { result.max = value; }
result.cores.push(value);
if (!isNaN(value)) {
sum = sum + value;
if (value > result.max) { result.max = value; }
result.cores.push(value);
}
});
if (result.cores.length) {
result.main = sum / result.cores.length;