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:
Jan-Otto Kröpke
2025-04-06 11:57:14 +02:00
committed by GitHub
parent bf56e99ad2
commit ba605cffcc
5 changed files with 45 additions and 16 deletions

View File

@@ -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)
}