Пример #1
0
        public void Write(DateTime64Type dateTime64Type, object value)
        {
            var dateTimeOffset = dateTime64Type.ToDateTimeOffset((DateTime)value);
            var ticks          = (dateTimeOffset.UtcDateTime - TypeConverter.DateTimeEpochStart).Ticks;

            // 7 is a 'magic constant' - Log10 of TimeSpan.TicksInSecond
            writer.Write(MathUtils.ShiftDecimalPlaces(ticks, dateTime64Type.Scale - 7));
        }
 public object Read(DateTime64Type dateTimeType) => TypeConverter.DateTimeEpochStart.AddTicks(MathUtils.ShiftDecimalPlaces(reader.ReadInt64(), 7 - dateTimeType.Scale));