Skip to content

Commit e6417e2

Browse files
committed
Fix date variant to time.Time conversion
* Fix VariantTimeToSystemTime call * Add time.UTC as a default Location
1 parent 085abb8 commit e6417e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

com.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ func DispatchMessage(msg *Msg) (ret int32) {
321321
// GetVariantDate converts COM Variant Time value to Go time.Time.
322322
func GetVariantDate(value float64) (time.Time, error) {
323323
var st syscall.Systemtime
324-
r, _, _ := procVariantTimeToSystemTime.Call(uintptr(unsafe.Pointer(&value)), uintptr(unsafe.Pointer(&st)))
324+
r, _, _ := procVariantTimeToSystemTime.Call(uintptr(value), uintptr(unsafe.Pointer(&st)))
325325
if r != 0 {
326-
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), nil), nil
326+
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
327327
}
328328
return time.Now(), errors.New("Could not convert to time, passing current time.")
329329
}

0 commit comments

Comments
 (0)