Source:
<code>private void processNextPeriodicMeterReads(final PeriodType periodType, final DateTime beginDateTime, final DateTime endDateTime, final List<PeriodicMeterReadsGas> periodicMeterReads, final List<DataObject> bufferedObjects, final Channel channel, final boolean isSelectiveAccessSupported, final List<GetResult> results) throws ProtocolAdapterException { final DataObject clock = bufferedObjects.get(BUFFER_INDEX_CLOCK); <START> final CosemDateTime cosemDateTime = this.dlmsHelperService.fromDateTimeValue((byte[]) clock.value()); <END> final DateTime bufferedDateTime = cosemDateTime.asDateTime(); if (bufferedDateTime == null) { final DateTimeFormatter dtf = ISODateTimeFormat.dateTime(); LOGGER.warn("Not using an object from capture buffer (clock=" + cosemDateTime.toString() + "), because the date does not match the given period, since it is not fully specified: [" + dtf.print(beginDateTime) + " .. " + dtf.print(endDateTime) + "]."); return; } if (bufferedDateTime.isBefore(beginDateTime) || bufferedDateTime.isAfter(endDateTime)) { final DateTimeFormatter dtf = ISODateTimeFormat.dateTime(); LOGGER.warn("Not using an object from capture buffer (clock=" + dtf.print(bufferedDateTime) + "), because the date does not match the given period: [" + dtf.print(beginDateTime) + " .. " + dtf.print(endDateTime) + "]."); return; } LOGGER.debug("Processing profile (" + periodType + ") objects captured at: {}", this.dlmsHelperService.getDebugInfo(clock)); switch (periodType) { case INTERVAL: this.processNextPeriodicMeterReadsForInterval(periodicMeterReads, bufferedObjects, bufferedDateTime, results); break; case DAILY: this.processNextPeriodicMeterReadsForDaily(periodicMeterReads, bufferedObjects, bufferedDateTime, channel, isSelectiveAccessSupported, results); break; case MONTHLY: this.processNextPeriodicMeterReadsForMonthly(periodicMeterReads, bufferedObjects, bufferedDateTime, channel, isSelectiveAccessSupported, results); break; default: throw new AssertionError("Unknown PeriodType: " + periodType); } }</code><technical_language>method readDateTime dlmsHelperService is a bit more robust fromDateTimeValue assuming a byte array DataObject</technical_language>

Target:
private void processNextPeriodicMeterReads(final PeriodType periodType, final DateTime beginDateTime, final DateTime endDateTime, final List<PeriodicMeterReadsGas> periodicMeterReads, final List<DataObject> bufferedObjects, final Channel channel, final boolean isSelectiveAccessSupported, final List<GetResult> results) throws ProtocolAdapterException { final CosemDateTime cosemDateTime = this.dlmsHelperService.readDateTime( bufferedObjects.get(BUFFER_INDEX_CLOCK), "Clock from " + periodType + " buffer"); final DateTime bufferedDateTime = cosemDateTime.asDateTime(); if (bufferedDateTime == null) { final DateTimeFormatter dtf = ISODateTimeFormat.dateTime(); LOGGER.warn("Not using an object from capture buffer (clock=" + cosemDateTime.toString() + "), because the date does not match the given period, since it is not fully specified: [" + dtf.print(beginDateTime) + " .. " + dtf.print(endDateTime) + "]."); return; } if (bufferedDateTime.isBefore(beginDateTime) || bufferedDateTime.isAfter(endDateTime)) { final DateTimeFormatter dtf = ISODateTimeFormat.dateTime(); LOGGER.warn("Not using an object from capture buffer (clock=" + dtf.print(bufferedDateTime) + "), because the date does not match the given period: [" + dtf.print(beginDateTime) + " .. " + dtf.print(endDateTime) + "]."); return; } LOGGER.debug("Processing profile (" + periodType + ") objects captured at: {}", cosemDateTime); switch (periodType) { case INTERVAL: this.processNextPeriodicMeterReadsForInterval(periodicMeterReads, bufferedObjects, bufferedDateTime, results); break; case DAILY: this.processNextPeriodicMeterReadsForDaily(periodicMeterReads, bufferedObjects, bufferedDateTime, channel, isSelectiveAccessSupported, results); break; case MONTHLY: this.processNextPeriodicMeterReadsForMonthly(periodicMeterReads, bufferedObjects, bufferedDateTime, channel, isSelectiveAccessSupported, results); break; default: throw new AssertionError("Unknown PeriodType: " + periodType); } }