xmtop/devices/temp_windows.go
Sean E. Russell 7a89225d72 Abstracts CPU & mem devices.
Finishes device refactoring: temps

Refactoring to allow updating maps. Simpler, and optimizable.
2020-02-28 07:06:51 -06:00

25 lines
430 B
Go

// +build windows
package devices
import (
psHost "github.com/shirou/gopsutil/host"
)
func init() {
RegisterTemp(update)
}
func update(temps map[string]int) map[string]error {
sensors, err := psHost.SensorsTemperatures()
if err != nil {
return map[string]error{"gopsutil": err}
}
for _, sensor := range sensors {
if sensor.Temperature != 0 {
temps[sensor.SensorKey] = int(sensor.Temperature)
}
}
return nil
}