04.03.2019 23:01, Mark Rotteveel wrote:

My question is about the **encoding** in the data buffer obtained from the native client. I want to avoid incorrectly implementing the support in Jaybird. And FYI, In the wire protocol 16 bit integers are encoded as 32 bit integers, and the length of the buffer from fbclient (12 instead of 10 bytes for TIMESTAMP WITH TIME ZONE) seemed to suggest it is in native as well. However as I said in my reply above, it probably is just padded to a multiple of 4.

typedef struct
{
  ISC_TIMESTAMP utc_timestamp;
  ISC_USHORT time_zone;
} ISC_TIMESTAMP_TZ;

alignof(time_zone) == 2, sizeof(time_zone) == 2

i.e. time zone (two bytes) is stored immediately after the timestamp (no padding)

However:

sizeof(ISC_TIMESTAMP_TZ) == 12

i.e. the whole structure is padded (with two bytes) at the end

I'm not sure whether it's "as desired" though. IIRC, alignment/padding is implementation-defined in C++, we're playing on the tricky field.


Dmitry


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to