Explorar el Código

Fix unixnano marshaling of timestamps

Matt Heath hace 10 años
padre
commit
10c63fdbeb
Se han modificado 1 ficheros con 1 adiciones y 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)