diff --git a/src/blackmisc/timestampobjectlist.cpp b/src/blackmisc/timestampobjectlist.cpp index a5e5ff89d..43497bff0 100644 --- a/src/blackmisc/timestampobjectlist.cpp +++ b/src/blackmisc/timestampobjectlist.cpp @@ -187,25 +187,25 @@ namespace BlackMisc } template - void ITimestampObjectList::removeBefore(const QDateTime &dateTime) + int ITimestampObjectList::removeBefore(const QDateTime &dateTime) { - this->removeBefore(dateTime.toMSecsSinceEpoch()); + return this->removeBefore(dateTime.toMSecsSinceEpoch()); } template - void ITimestampObjectList::removeBefore(qint64 msSinceEpoc) + int ITimestampObjectList::removeBefore(qint64 msSinceEpoc) { - this->container().removeIf([&](const OBJ & obj) + return this->container().removeIf([&](const OBJ & obj) { return obj.isOlderThan(msSinceEpoc); }); } template - void ITimestampObjectList::removeOlderThanNowMinusOffset(qint64 offsetMs) + int ITimestampObjectList::removeOlderThanNowMinusOffset(qint64 offsetMs) { const qint64 epoch = QDateTime::currentMSecsSinceEpoch() - offsetMs; - this->container().removeIf([&](const OBJ & obj) + return this->container().removeIf([&](const OBJ & obj) { return obj.isOlderThan(epoch); }); diff --git a/src/blackmisc/timestampobjectlist.h b/src/blackmisc/timestampobjectlist.h index 3737c2d91..d59c1d0dc 100644 --- a/src/blackmisc/timestampobjectlist.h +++ b/src/blackmisc/timestampobjectlist.h @@ -78,13 +78,13 @@ namespace BlackMisc OBJ oldestObject() const; //! Remove objects with timestamp before dateTime - void removeBefore(const QDateTime &dateTime); + int removeBefore(const QDateTime &dateTime); //! Remove objects with timestamp before dateTime - void removeBefore(qint64 msSinceEpoch); + int removeBefore(qint64 msSinceEpoch); //! Remove objects older than seconds - void removeOlderThanNowMinusOffset(qint64 offsetMs); + int removeOlderThanNowMinusOffset(qint64 offsetMs); //! Sort by timestamp void sortLatestFirst();