Beispiel #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);
     }
 }
Beispiel #2
0
 public override int GetObjectEncodeSize(object value, bool arrayEncoding)
 {
     if (arrayEncoding)
     {
         return(FixedWidth.TimeStamp);
     }
     else
     {
         return(TimeStampEncoding.GetEncodeSize((DateTime)value));
     }
 }
Beispiel #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);
     }
 }
Beispiel #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));
 }
Beispiel #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)));
 }
Beispiel #6
0
 public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode)
 {
     return(TimeStampEncoding.Decode(buffer, formatCode));
 }