erm/internal/app/darktile/hinters/uptime_builtin.go
Qiu 97b6a41eb3
Make getting the up-time more portable across unix-like systems (#326)
* Make getting the up-time more portable across unix-like systems

* Fix the build on NetBSD

* Update Go version in workflows
2021-12-17 08:39:48 +00:00

14 lines
190 B
Go

//go:build cgo && (linux || netbsd)
package hinters
import (
"syscall"
)
func getUptime() int64 {
sysInfo := &syscall.Sysinfo_t{}
_ = syscall.Sysinfo(sysInfo)
return sysInfo.Uptime
}