From 9a3aa55b294e53beed3c34d4b23ac9537b04a7ee Mon Sep 17 00:00:00 2001 From: David Kahles Date: Fri, 8 Nov 2019 11:55:21 +0100 Subject: [PATCH] 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 --- src/gui/activitydata.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/activitydata.cpp b/src/gui/activitydata.cpp index b0236658e..866c97956 100644 --- a/src/gui/activitydata.cpp +++ b/src/gui/activitydata.cpp @@ -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) -- 2.30.2