Explorar o código

Fix unixnano marshaling of timestamps

Matt Heath %!s(int64=10) %!d(string=hai) anos
pai
achega
10c63fdbeb
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      marshal.go

+ 1 - 1
marshal.go

@@ -802,7 +802,7 @@ func marshalTimestamp(info TypeInfo, value interface{}) ([]byte, error) {
 	case int64:
 		return encBigInt(v), nil
 	case time.Time:
-		x := v.UnixNano() / int64(1000000)
+		x := int64(v.UTC().Unix()*1e3) + int64(v.UTC().Nanosecond()/1e6)
 		return encBigInt(x), nil
 	}
 	rv := reflect.ValueOf(value)