PackedLocalTime { public static int pack(LocalTime time) { if (time == null) { return TimeColumnType.missingValueIndicator(); } byte hour = (byte) time.getHour(); byte minute = (byte) time.getMinute(); char millis = (char) (time.getNano() / 1_000_000.0); millis = (char) (millis + (char) (time.getSecond() * 1000)); return create(hour, minute, millis); }  static byte getHour(int time); static int of(int hour, int minute); static int of(int hour, int minute, int second); static int of(int hour, int minute, int second, int millis); static int truncatedTo(TemporalUnit unit, int packedTime); static int plusHours(int hoursToAdd, int packedTime); static int plusMinutes(int minutesToAdd, int packedTime); static int plusSeconds(int secondsToAdd, int packedTime); static int plusMilliseconds(int msToAdd, int packedTime); static int minusHours(int hoursToSubtract, int packedTime); static int minusMinutes(int minutesToSubtract, int packedTime); static int minusSeconds(int secondsToSubtract, int packedTime); static int minusMilliseconds(int millisToSubtract, int packedTime); static int withHour(int hour, int packedTime); static int withMinute(int minute, int packedTime); static int withSecond(int second, int packedTime); static int withMillisecond(int milliseconds, int packedTime); static char getMillisecondOfMinute(int time); static int getNano(int time); static int getMilliseconds(int time); static long toNanoOfDay(int time); static LocalTime asLocalTime(int time); static byte getMinute(int time); static int pack(LocalTime time); static byte getSecond(int packedLocalTime); static int getMinuteOfDay(int packedLocalTime); static int getSecondOfDay(int packedLocalTime); static int getMillisecondOfDay(int packedLocalTime); static String toShortTimeString(int time); static boolean isMidnight(int packedTime); static boolean isNoon(int packedTime); static boolean isAfter(int packedTime, int otherPackedTime); static boolean isOnOrAfter(int packedTime, int otherPackedTime); static boolean isBefore(int packedTime, int otherPackedTime); static boolean isOnOrBefore(int packedTime, int otherPackedTime); static boolean isEqualTo(int packedTime, int otherPackedTime); static boolean AM(int packedTime); static boolean PM(int packedTime); static int hoursUntil(int packedTimeEnd, int packedTimeStart); static int minutesUntil(int packedTimeEnd, int packedTimeStart); static int secondsUntil(int packedTimeEnd, int packedTimeStart);  }
@Test public void testPack() { LocalTime time = LocalTime.now(); int packed = pack(time); LocalTime t1 = asLocalTime(PackedLocalDateTime.time(packed)); assertNotNull(t1); assertEquals(time.getHour(), t1.getHour()); assertEquals(time.getMinute(), t1.getMinute()); assertEquals(time.getSecond(), t1.getSecond()); assertEquals(time.get(ChronoField.MILLI_OF_SECOND), t1.get(ChronoField.MILLI_OF_SECOND)); }