diff --git a/CHANGELOG.md b/CHANGELOG.md index 2989237..ad9d585 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.30.3 | 2017-10-03 | bugfix `cpuTemperature()` - max value on windows | | 3.30.2 | 2017-09-26 | bugfix `networkInterfaces()` - optimized ip6 address selection | | 3.30.1 | 2017-09-21 | bugfix/typo `inetChecksite()` | | 3.30.0 | 2017-09-21 | extended `versions()` (added `yarn`, `gulp`, `grunt`, `tsc`, `git`) | diff --git a/README.md b/README.md index 02a0096..0d6734d 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] ( | | min | X | X | X | min CPU speed (all cores) | | | max | X | X | X | max CPU speed (all cores) | | si.cpuTemperature(cb) | {...} | X | X* | X | CPU temperature (if supported) | -| | main | X | X | X | main temperature | +| | main | X | X | X | main temperature (avg) | | | cores | X | X | X | array of temperatures | | | max | X | X | X | max temperature | | si.mem(cb) | {...} | X | X | X | Memory information (in bytes)| diff --git a/lib/cpu.js b/lib/cpu.js index c4d0d9d..9026f49 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -366,11 +366,13 @@ function cpuTemperature(callback) { let sum = 0; let lines = stdout.trim().split(/\s\s+/); lines.forEach(function (line) { - if (line.match('CriticalTripPoint') && !result.max) - result.max = (parseInt(line.split('CriticalTripPoint=')[1]) - 2732) / 10; - else if (line.match('CurrentTemperature')) { + // if (line.match('CriticalTripPoint') && result.max === -1) + // result.max = (parseInt(line.split('CriticalTripPoint=')[1]) - 2732) / 10; + // else + if (line.match('CurrentTemperature')) { let value = (parseInt(line.split('CurrentTemperature=')[1]) - 2732) / 10; sum = sum + value; + if (value > result.max) result.max = value; result.cores.push(value); } });