Exemplo n.º 1
0
 public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer)
 {
     if (arrayEncoding)
     {
         AmqpBitConverter.WriteLong(buffer, TimeStampEncoding.GetMilliseconds((DateTime)value));
     }
     else
     {
         TimeStampEncoding.Encode((DateTime)value, buffer);
     }
 }
Exemplo n.º 2
0
 public override int GetObjectEncodeSize(object value, bool arrayEncoding)
 {
     if (arrayEncoding)
     {
         return(FixedWidth.TimeStamp);
     }
     else
     {
         return(TimeStampEncoding.GetEncodeSize((DateTime)value));
     }
 }
Exemplo n.º 3
0
 public static void Encode(DateTime?value, ByteBuffer buffer)
 {
     if (value.HasValue)
     {
         AmqpBitConverter.WriteUByte(buffer, FormatCode.TimeStamp);
         AmqpBitConverter.WriteLong(buffer, TimeStampEncoding.GetMilliseconds(value.Value));
     }
     else
     {
         AmqpEncoding.EncodeNull(buffer);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Writes a timestamp to a buffer.
 /// </summary>
 /// <param name="buffer">The buffer to write.</param>
 /// <param name="data">The timestamp.</param>
 public static void WriteTimestamp(ByteBuffer buffer, DateTime data)
 {
     AmqpBitConverter.WriteLong(buffer, TimeStampEncoding.GetMilliseconds(data));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Reads a timestamp from a buffer.
 /// </summary>
 /// <param name="buffer">The input buffer.</param>
 /// <returns>A timestamp.</returns>
 public static DateTime ReadTimestamp(ByteBuffer buffer)
 {
     return(TimeStampEncoding.ToDateTime(AmqpBitConverter.ReadLong(buffer)));
 }
Exemplo n.º 6
0
 public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode)
 {
     return(TimeStampEncoding.Decode(buffer, formatCode));
 }