Added uptime functionality
This commit is contained in:
1 parent
403b621478
commit
6430e5ddca
5 files changed
+125
-2
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user