Added uptime functionality

This commit is contained in:
lin committed 2026-10-05 22:12:10 +02:00
1 parent 403b621478
commit 6430e5ddca
5 files changed
+125 -2

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
//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)
}