public PacketOutputStream writeTimeLength(final Calendar calendar,final boolean fractionalSeconds){
  if (fractionalSeconds) {
    assureBufferCapacity(13);
    buffer.put((byte)12);
    buffer.put((byte)0);
    buffer.putInt(0);
    buffer.put((byte)calendar.get(Calendar.HOUR_OF_DAY));
    buffer.put((byte)calendar.get(Calendar.MINUTE));
    buffer.put((byte)calendar.get(Calendar.SECOND));
    buffer.putInt(calendar.get(Calendar.MILLISECOND) * 1000);
  }
 else {
    assureBufferCapacity(9);
    buffer.put((byte)8);
    buffer.put((byte)0);
    buffer.putInt(0);
    buffer.put((byte)calendar.get(Calendar.HOUR_OF_DAY));
    buffer.put((byte)calendar.get(Calendar.MINUTE));
    buffer.put((byte)calendar.get(Calendar.SECOND));
  }
  return this;
}

public PacketOutputStream writeTimeLength ( final Calendar calendar , final boolean fractionalSeconds ) { if ( fractionalSeconds ) { assureBufferCapacity ( 13 ) ; buffer . put ( ( byte ) 12 ) ; buffer . put ( ( byte ) 0 ) ; buffer . putInt ( 0 ) ; buffer . put ( ( byte ) calendar . get ( Calendar . HOUR_OF_DAY ) ) ; buffer . put ( ( byte ) calendar . get ( Calendar . MINUTE ) ) ; buffer . put ( ( byte ) calendar . get ( Calendar . SECOND ) ) ; buffer . putInt ( calendar . get ( Calendar . MILLISECOND ) * 1000 ) ; } else { assureBufferCapacity ( 9 ) ; buffer . put ( ( byte ) 8 ) ; buffer . put ( ( byte ) 0 ) ; buffer . putInt ( 0 ) ; buffer . put ( ( byte ) calendar . get ( Calendar . HOUR_OF_DAY ) ) ; buffer . put ( ( byte ) calendar . get ( Calendar . MINUTE ) ) ; buffer . put ( ( byte ) calendar . get ( Calendar . SECOND ) ) ; } return this ; }
write time in binary format .
