@Test public void exactTime256WithUpdateReason_stGeorgesDay2017_manualUpdate() { assertArrayEquals( new byte[]{-31, 7, 4, 23, 13, 36, 59, 7, 0, 1}, TimeData.exactTime256WithUpdateReason(utc("13:36:59 23 Apr 2017"), TimeData.UPDATE_REASON_MANUAL) ); }
static byte[] exactTime256WithUpdateReason(Calendar time, byte updateReason) { int month = time.get(Calendar.MONTH) + 1; int dayOfWeek = time.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SUNDAY) { dayOfWeek = 7; } else { dayOfWeek = dayOfWeek - 1; } int fractionsOfSecond = (int)((time).get(Calendar.MILLISECOND) * 0.255F); return ByteBuffer.allocate(10) .order(ByteOrder.LITTLE_ENDIAN) .putShort((short) time.get(Calendar.YEAR)) .put((byte) month) .put((byte) time.get(Calendar.DAY_OF_MONTH)) .put((byte) time.get(Calendar.HOUR_OF_DAY)) .put((byte) time.get(Calendar.MINUTE)) .put((byte) time.get(Calendar.SECOND)) .put((byte) dayOfWeek) .put((byte) fractionsOfSecond) .put(updateReason) .array(); }
TimeData { static byte[] exactTime256WithUpdateReason(Calendar time, byte updateReason) { int month = time.get(Calendar.MONTH) + 1; int dayOfWeek = time.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SUNDAY) { dayOfWeek = 7; } else { dayOfWeek = dayOfWeek - 1; } int fractionsOfSecond = (int)((time).get(Calendar.MILLISECOND) * 0.255F); return ByteBuffer.allocate(10) .order(ByteOrder.LITTLE_ENDIAN) .putShort((short) time.get(Calendar.YEAR)) .put((byte) month) .put((byte) time.get(Calendar.DAY_OF_MONTH)) .put((byte) time.get(Calendar.HOUR_OF_DAY)) .put((byte) time.get(Calendar.MINUTE)) .put((byte) time.get(Calendar.SECOND)) .put((byte) dayOfWeek) .put((byte) fractionsOfSecond) .put(updateReason) .array(); } }
TimeData { static byte[] exactTime256WithUpdateReason(Calendar time, byte updateReason) { int month = time.get(Calendar.MONTH) + 1; int dayOfWeek = time.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SUNDAY) { dayOfWeek = 7; } else { dayOfWeek = dayOfWeek - 1; } int fractionsOfSecond = (int)((time).get(Calendar.MILLISECOND) * 0.255F); return ByteBuffer.allocate(10) .order(ByteOrder.LITTLE_ENDIAN) .putShort((short) time.get(Calendar.YEAR)) .put((byte) month) .put((byte) time.get(Calendar.DAY_OF_MONTH)) .put((byte) time.get(Calendar.HOUR_OF_DAY)) .put((byte) time.get(Calendar.MINUTE)) .put((byte) time.get(Calendar.SECOND)) .put((byte) dayOfWeek) .put((byte) fractionsOfSecond) .put(updateReason) .array(); } private  TimeData(); }
TimeData { static byte[] exactTime256WithUpdateReason(Calendar time, byte updateReason) { int month = time.get(Calendar.MONTH) + 1; int dayOfWeek = time.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SUNDAY) { dayOfWeek = 7; } else { dayOfWeek = dayOfWeek - 1; } int fractionsOfSecond = (int)((time).get(Calendar.MILLISECOND) * 0.255F); return ByteBuffer.allocate(10) .order(ByteOrder.LITTLE_ENDIAN) .putShort((short) time.get(Calendar.YEAR)) .put((byte) month) .put((byte) time.get(Calendar.DAY_OF_MONTH)) .put((byte) time.get(Calendar.HOUR_OF_DAY)) .put((byte) time.get(Calendar.MINUTE)) .put((byte) time.get(Calendar.SECOND)) .put((byte) dayOfWeek) .put((byte) fractionsOfSecond) .put(updateReason) .array(); } private  TimeData();  }
TimeData { static byte[] exactTime256WithUpdateReason(Calendar time, byte updateReason) { int month = time.get(Calendar.MONTH) + 1; int dayOfWeek = time.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SUNDAY) { dayOfWeek = 7; } else { dayOfWeek = dayOfWeek - 1; } int fractionsOfSecond = (int)((time).get(Calendar.MILLISECOND) * 0.255F); return ByteBuffer.allocate(10) .order(ByteOrder.LITTLE_ENDIAN) .putShort((short) time.get(Calendar.YEAR)) .put((byte) month) .put((byte) time.get(Calendar.DAY_OF_MONTH)) .put((byte) time.get(Calendar.HOUR_OF_DAY)) .put((byte) time.get(Calendar.MINUTE)) .put((byte) time.get(Calendar.SECOND)) .put((byte) dayOfWeek) .put((byte) fractionsOfSecond) .put(updateReason) .array(); } private  TimeData();   }