@Override
    public void write(final MySQLPacketPayload payload, final Object value) {
        LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(((Time) value).getTime()), ZoneId.systemDefault());
        int hours = localDateTime.getHour();
        int minutes = localDateTime.getMinute();
        int seconds = localDateTime.getSecond();
        int nanos = localDateTime.getNano();
        boolean isTimeAbsent = 0 == hours && 0 == minutes && 0 == seconds;
        boolean isNanosAbsent = 0 == nanos;
        if (isTimeAbsent && isNanosAbsent) {
            payload.writeInt1(0);
            return;
        }
        if (isNanosAbsent) {
            payload.writeInt1(8);
            writeTime(payload, hours, minutes, seconds);
            return;
        }
        payload.writeInt1(12);
        writeTime(payload, hours, minutes, seconds);
        writeNanos(payload, nanos);
    }
@Test
    void assertWriteWithEightBytes() {
        MySQLTimeBinaryProtocolValue actual = new MySQLTimeBinaryProtocolValue();
        actual.write(payload, Time.valueOf("01:30:10"));
        verify(payload).writeInt1(8);
        verify(payload).writeInt1(0);
        verify(payload).writeInt4(0);
        payload.writeInt1(0);
        payload.writeInt4(0);
        verify(payload).writeInt1(1);
        verify(payload).writeInt1(30);
        verify(payload).writeInt1(10);
    }