mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-24 13:48:56 +08:00
change to use procGetTickCount.Call() instead of syscall.
This commit is contained in:
parent
f7498f6d12
commit
96547e0d22
@ -22,15 +22,10 @@ func HostInfo() (HostInfoStat, error) {
|
||||
}
|
||||
|
||||
ret.Hostname = hostname
|
||||
|
||||
kernel32, err := syscall.LoadLibrary("kernel32.dll")
|
||||
if err != nil {
|
||||
return ret, err
|
||||
uptimemsec, _, err := procGetTickCount.Call()
|
||||
if uptimemsec == 0 {
|
||||
return ret, syscall.GetLastError()
|
||||
}
|
||||
defer syscall.FreeLibrary(kernel32)
|
||||
GetTickCount, _ := syscall.GetProcAddress(kernel32, "GetTickCount")
|
||||
|
||||
uptimemsec, _, err := syscall.Syscall(uintptr(GetTickCount), 0, 0, 0, 0)
|
||||
|
||||
ret.Uptime = int64(uptimemsec) / 1000
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user