滑动窗口采用的是guava中提供的Range数据结构
里面存取的是一段时间范围
public static Range<Long> buildRange(int minInterval, Integer windowRange, Integer windowSize, LocalDateTime time) {
long ts = time.toEpochSecond(ZoneOffset.of("+8"));
ts /= windowRange;
ts *= windowRange;
long endTime = ts - minInterval;
long startTime = endTime - windowRange * windowSize;
return Range.closedOpen(startTime, endTime); // 前闭后开的时间范围
}
标签:窗口,ts,long,windowRange,Range,滑动,endTime
From: https://www.cnblogs.com/PythonOrg/p/16881312.html