Compare QDateTime objects more efficient

There is no need to call toMSecsSinceEpoch() as QDateTime implements an
comparison operator itself. This is more efficient, because the
QDateTime comparison operator doesn't call localtime() in all cases. Thus, we
don't read /etc/localtime for every comparison. This improves
performance in some cases.

Signed-off-by: David Kahles <david.kahles96@gmail.com>
This commit is contained in:
David Kahles 2019-11-08 11:55:21 +01:00 committed by Michael Schuster
parent 30829d0669
commit 9a3aa55b29

View file

@ -21,7 +21,7 @@ namespace OCC {
bool operator<(const Activity &rhs, const Activity &lhs)
{
return rhs._dateTime.toMSecsSinceEpoch() > lhs._dateTime.toMSecsSinceEpoch();
return rhs._dateTime > lhs._dateTime;
}
bool operator==(const Activity &rhs, const Activity &lhs)