public PacketOutputStream writeTimestampLength(final Calendar calendar,Timestamp ts,boolean fractionalSeconds){
  assureBufferCapacity(fractionalSeconds ? 12 : 8);
  buffer.put((byte)(fractionalSeconds ? 11 : 7));
  buffer.putShort((short)calendar.get(Calendar.YEAR));
  buffer.put((byte)((calendar.get(Calendar.MONTH) + 1) & 0xff));
  buffer.put((byte)(calendar.get(Calendar.DAY_OF_MONTH) & 0xff));
  buffer.put((byte)calendar.get(Calendar.HOUR_OF_DAY));
  buffer.put((byte)calendar.get(Calendar.MINUTE));
  buffer.put((byte)calendar.get(Calendar.SECOND));
  if (fractionalSeconds) {
    buffer.putInt(ts.getNanos() / 1000);
  }
  return this;
}

public PacketOutputStream writeTimestampLength ( final Calendar calendar , Timestamp ts , boolean fractionalSeconds ) { assureBufferCapacity ( fractionalSeconds ? 12 : 8 ) ; buffer . put ( ( byte ) ( fractionalSeconds ? 11 : 7 ) ) ; buffer . putShort ( ( short ) calendar . get ( Calendar . YEAR ) ) ; buffer . put ( ( byte ) ( ( calendar . get ( Calendar . MONTH ) + 1 ) & 0xff ) ) ; buffer . put ( ( byte ) ( calendar . get ( Calendar . DAY_OF_MONTH ) & 0xff ) ) ; buffer . put ( ( byte ) calendar . get ( Calendar . HOUR_OF_DAY ) ) ; buffer . put ( ( byte ) calendar . get ( Calendar . MINUTE ) ) ; buffer . put ( ( byte ) calendar . get ( Calendar . SECOND ) ) ; if ( fractionalSeconds ) { buffer . putInt ( ts . getNanos ( ) / 1000 ) ; } return this ; }
write timestamp in binary format .
