public static boolean isAggregationDataCompleteAgainstTime(long timestamp, TimePeriod.Duration duration,
            String timeZone) {
        ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timestamp),
                ZoneId.of(timeZone));
        ZonedDateTime zonedCurrentDateTime = ZonedDateTime.ofInstant(Instant.now(), ZoneId.of(timeZone));
        switch (duration) {
            case SECONDS:
                return false;
            case MINUTES:
                return zonedDateTime.getYear() == zonedCurrentDateTime.getYear() &&
                        zonedDateTime.getMonthValue() == zonedCurrentDateTime.getDayOfMonth() &&
                        zonedDateTime.getDayOfMonth() == zonedCurrentDateTime.getDayOfMonth() &&
                        zonedDateTime.getHour() == zonedCurrentDateTime.getHour() &&
                        zonedDateTime.getMinute() == (zonedCurrentDateTime.getMinute() - 1);
            case HOURS:
                return zonedDateTime.getYear() == zonedCurrentDateTime.getYear() &&
                        zonedDateTime.getMonthValue() == zonedCurrentDateTime.getDayOfMonth() &&
                        zonedDateTime.getDayOfMonth() == zonedCurrentDateTime.getDayOfMonth() &&
                        zonedDateTime.getHour() == (zonedCurrentDateTime.getHour() - 1);
            case DAYS:
                return zonedDateTime.getYear() == zonedCurrentDateTime.getYear() &&
                        zonedDateTime.getMonthValue() == zonedCurrentDateTime.getDayOfMonth() &&
                        zonedDateTime.getDayOfMonth() == (zonedCurrentDateTime.getDayOfMonth() - 1);
            case MONTHS:
                return zonedDateTime.getYear() == zonedCurrentDateTime.getYear() &&
                        zonedDateTime.getMonthValue() == (zonedCurrentDateTime.getMonthValue() - 1);
            case YEARS:
                return zonedDateTime.getYear() == (zonedCurrentDateTime.getYear() - 1);
        }
        return false;
    }
Performs time conversions related to incremental aggregation.
modules/siddhi-core/src/main/java/io/siddhi/core/util/IncrementalTimeConverterUtil.java