Exemplo n.º 1
0
        public override byte[] Serialize(ushort protocolVersion, DateTime value)
        {
            // Treat "Unspecified" as UTC (+0) not the default behavior of DateTimeOffset which treats as Local Timezone
            // because we are about to do math against EPOCH which must align with UTC.
            var dateTimeOffset = value.Kind == DateTimeKind.Unspecified
                ? new DateTimeOffset(value, TimeSpan.Zero)
                : new DateTimeOffset(value);

            return(DateTimeOffsetSerializer.Serialize(dateTimeOffset));
        }
Exemplo n.º 2
0
        public override DateTime Deserialize(ushort protocolVersion, byte[] buffer, int offset, int length, IColumnInfo typeInfo)
        {
            var dto = DateTimeOffsetSerializer.Deserialize(buffer, offset);

            return(dto.DateTime);
        }