code: public void writeBinary(final PacketOutputStream pos) throws IOException {
      Calendar calendar = Calendar.getInstance(timeZone);
      calendar.setTime(time);
      calendar.set(Calendar.DAY_OF_MONTH, 1);
      if (fractionalSeconds) {
        pos.write((byte) 12);
        pos.write((byte) 0);
        pos.writeInt(0);
        pos.write((byte) calendar.get(Calendar.HOUR_OF_DAY));
        pos.write((byte) calendar.get(Calendar.MINUTE));
        pos.write((byte) calendar.get(Calendar.SECOND));
        pos.writeInt(calendar.get(Calendar.MILLISECOND) * 1000);
      } else {
        pos.write((byte) 8);//length
        pos.write((byte) 0);
        pos.writeInt(0);
        pos.write((byte) calendar.get(Calendar.HOUR_OF_DAY));
        pos.write((byte) calendar.get(Calendar.MINUTE));
        pos.write((byte) calendar.get(Calendar.SECOND));
      }
    }
docs: Write data to socket in binary format.
  
  @param pos socket output stream
  @throws IOException if socket error occur