-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
await for (ValuePair pair in fetchHistoryData(range)) {
rollup.add(pair.value);
if (lastTimestamp != -1) {
totalTime += pair.time.millisecondsSinceEpoch - lastTimestamp;
}
lastTimestamp = pair.time.millisecondsSinceEpoch;
if (totalTime >= interval.inMilliseconds) {
totalTime = 0;
result = new ValuePair(
new DateTime.fromMillisecondsSinceEpoch(
lastTimestamp
).toIso8601String(),
rollup.value
);
yield result;
result = null;
rollup.reset();
}
}
What I don't like
- if point out of interval, it gets included into interval
- beginning of the next interval is last point not included in the previous interval
- lastTimestamp goes to the result
Metadata
Metadata
Assignees
Labels
No labels