github.com/hspan/go-ole@v0.0.0/variant_date_amd64.go (about) 1 // +build windows,amd64 2 3 package ole 4 5 import ( 6 "errors" 7 "syscall" 8 "time" 9 "unsafe" 10 ) 11 12 // GetVariantDate converts COM Variant Time value to Go time.Time. 13 func GetVariantDate(value uint64) (time.Time, error) { 14 var st syscall.Systemtime 15 r, _, _ := procVariantTimeToSystemTime.Call(uintptr(value), uintptr(unsafe.Pointer(&st))) 16 if r != 0 { 17 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 18 } 19 return time.Now(), errors.New("Could not convert to time, passing current time.") 20 }