mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
system: Metric windows_system_boot_time_timestamp returns a UNIX timestamp again. (#1967)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
This commit is contained in:
@@ -25,10 +25,11 @@ import (
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var (
|
||||
kernel32 = windows.NewLazySystemDLL("kernel32.dll")
|
||||
modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
|
||||
|
||||
procGetDynamicTimeZoneInformationSys = kernel32.NewProc("GetDynamicTimeZoneInformation")
|
||||
kernelLocalFileTimeToFileTime = kernel32.NewProc("LocalFileTimeToFileTime")
|
||||
procGetDynamicTimeZoneInformationSys = modkernel32.NewProc("GetDynamicTimeZoneInformation")
|
||||
procKernelLocalFileTimeToFileTime = modkernel32.NewProc("LocalFileTimeToFileTime")
|
||||
procGetTickCount = modkernel32.NewProc("GetTickCount64")
|
||||
)
|
||||
|
||||
// SYSTEMTIME contains a date and time.
|
||||
@@ -72,9 +73,15 @@ func GetDynamicTimeZoneInformation() (DynamicTimezoneInformation, error) {
|
||||
}
|
||||
|
||||
func LocalFileTimeToFileTime(localFileTime, utcFileTime *windows.Filetime) uint32 {
|
||||
ret, _, _ := kernelLocalFileTimeToFileTime.Call(
|
||||
ret, _, _ := procKernelLocalFileTimeToFileTime.Call(
|
||||
uintptr(unsafe.Pointer(localFileTime)),
|
||||
uintptr(unsafe.Pointer(utcFileTime)))
|
||||
|
||||
return uint32(ret)
|
||||
}
|
||||
|
||||
func GetTickCount64() uint64 {
|
||||
ret, _, _ := procGetTickCount.Call()
|
||||
|
||||
return uint64(ret)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user