24 lines
478 B
Go
24 lines
478 B
Go
//go:build windows
|
|
|
|
package uptime
|
|
|
|
import (
|
|
"rpi5-health/internal/windows_system"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
type ULONGLONG uint64
|
|
|
|
func getWinUptime(uptime *windows.LazyProc) (UptimeInformation, error) {
|
|
uptimeMetric, _, _ := uptime.Call()
|
|
|
|
uptimeSeconds := float64(uptimeMetric) / 1000.0
|
|
|
|
return UptimeInformation{uptime: uptimeSeconds}, nil
|
|
}
|
|
|
|
func GetUptimeInformation() (UptimeInformation, error) {
|
|
return getWinUptime(windows_system.GetWindowsTools().Uptime)
|
|
}
|