mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 00:46:43 +00:00
75019baadd
* deps: update golang.org/x/sys * deps: update imports to gopsutil/v3 * chore: make update-vendor
21 lines
586 B
Go
21 lines
586 B
Go
// +build windows,amd64
|
|
|
|
package ole
|
|
|
|
import (
|
|
"errors"
|
|
"syscall"
|
|
"time"
|
|
"unsafe"
|
|
)
|
|
|
|
// GetVariantDate converts COM Variant Time value to Go time.Time.
|
|
func GetVariantDate(value uint64) (time.Time, error) {
|
|
var st syscall.Systemtime
|
|
r, _, _ := procVariantTimeToSystemTime.Call(uintptr(value), uintptr(unsafe.Pointer(&st)))
|
|
if r != 0 {
|
|
return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil
|
|
}
|
|
return time.Now(), errors.New("Could not convert to time, passing current time.")
|
|
}
|