diff --git a/src/fdb_tsdb.c b/src/fdb_tsdb.c index 2d7ebff..4ddc3b9 100644 --- a/src/fdb_tsdb.c +++ b/src/fdb_tsdb.c @@ -621,15 +621,11 @@ void fdb_tsl_iter_by_time(fdb_tsdb_t db, fdb_time_t from, fdb_time_t to, fdb_tsl do { read_tsl(db, &tsl); if (tsl.status != FDB_TSL_UNUSED) { - if (from <= to && tsl.time >= from && tsl.time <= to) { + if ((from <= to && tsl.time >= from && tsl.time <= to) || (from > to && tsl.time <= from && tsl.time >= to)) { /* iterator is interrupted when callback return true */ if (cb(&tsl, cb_arg)) { return; } - } else if (from > to && tsl.time <= from && tsl.time >= to){ - if (cb(&tsl, cb_arg)) { - return; - } } else { return; }