public object Deserialize(IPackStreamReader reader, byte signature, long size) { PackStream.EnsureStructSize("LocalDateTime", StructSize, size); var epochSeconds = reader.ReadLong(); var nanosOfSecond = reader.ReadInteger(); return(TemporalHelpers.EpochSecondsAndNanoToDateTime(epochSeconds, nanosOfSecond)); }
public object Deserialize(IPackStreamReader reader, byte signature, long size) { PackStream.EnsureStructSize($"ZonedDateTime[{(char) signature}]", StructSize, size); var epochSecondsUtc = reader.ReadLong(); var nanosOfSecond = reader.ReadInteger(); switch (signature) { case StructTypeWithId: return(new ZonedDateTime( TemporalHelpers.EpochSecondsAndNanoToDateTime(epochSecondsUtc, nanosOfSecond), Zone.Of(reader.ReadString()))); case StructTypeWithOffset: return(new ZonedDateTime( TemporalHelpers.EpochSecondsAndNanoToDateTime(epochSecondsUtc, nanosOfSecond), Zone.Of(reader.ReadInteger()))); default: throw new ProtocolException( $"Unsupported struct signature {signature} passed to {nameof(ZonedDateTimeSerializer)}!"); } }