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