private void initTiming(StreamEvent firstStreamEvent, WindowState state) {
        // for window beginning, if window is empty, set lastSendTime to incomingChunk first.
        if (state.endTime < 0) {
            if (isStartTimeEnabled) {
                if (startTimeAsVariable == null) {
                    state.endTime = findEndTime((Long) timestampExpressionExecutor.execute(firstStreamEvent),
                            state.startTime, timeToKeep);
                } else {
                    state.startTime = (Long) startTimeAsVariable.execute(firstStreamEvent);
                    state.endTime = state.startTime + timeToKeep;
                }
            } else {
                state.startTime = (Long) timestampExpressionExecutor.execute(firstStreamEvent);
                state.endTime = state.startTime + timeToKeep;
            }
            if (schedulerTimeout > 0) {
                state.lastScheduledTime = siddhiQueryContext.getSiddhiAppContext().
                        getTimestampGenerator().currentTime() + schedulerTimeout;
                scheduler.notifyAt(state.lastScheduledTime);
            }
        }
    }
Here an assumption is taken:
Parameter: timestamp: The time which the window determines as current time and will act upon,
the value of this parameter should be monotonically increasing.
from https://docs.wso2.com/display/CEP400/Inbuilt+Windows#InbuiltWindows-externalTime
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java