public static int getMillisecondsPerDuration(TimePeriod.Duration duration) {
        switch (duration) {
            case SECONDS:
                return 1000;
            case MINUTES:
                return 60000;
            case HOURS:
                return 3600000;
            case DAYS:
                return 86400000;
            default:
                throw new SiddhiAppRuntimeException("Cannot provide number of milliseconds per duration " + duration
                        + ".Number of milliseconds are only define for SECONDS, MINUTES, HOURS and DAYS");
        }
    }
Performs time conversions related to incremental aggregation.
modules/siddhi-core/src/main/java/io/siddhi/core/util/IncrementalTimeConverterUtil.java