Fix timeseries pruning

This commit is contained in:
Thomas Kolb 2025-01-13 22:32:07 +01:00
parent 77e987bccc
commit 4575628d99

View file

@ -27,11 +27,12 @@ void timeseries_prune(timeseries_t *ts, uint64_t duration)
uint64_t new_tstart = ts->tend - duration;
while(iter != ts->data.end() && iter->second < new_tstart) {
while(iter != ts->data.end() && iter->first < new_tstart) {
iter = ts->data.erase(iter);
}
if(iter != ts->data.end()) {
// iter now points to the first entry in the list
ts->tstart = iter->first;
} else {
ts->tstart = ts->tend;