[plasma/plasma-desktop] imports/activitymanager: [activitymanager] Use faster code paths for time calculations

Méven Car <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 0c536f094a1b8f4d5647e90f5695152841015df1 by Méven Car, on behalf of Christoph Grüninger.
Committed on 29/07/2026 at 07:58.
Pushed by meven into branch 'master'.

[activitymanager] Use faster code paths for time calculations

Found by Clazy (qdatetime-utc).

M  +1    -1    imports/activitymanager/sortedactivitiesmodel.cpp
M  +1    -1    imports/activitymanager/switcherbackend.cpp

https://invent.kde.org/plasma/plasma-desktop/-/commit/0c536f094a1b8f4d5647e90f5695152841015df1

diff --git a/imports/activitymanager/sortedactivitiesmodel.cpp b/imports/activitymanager/sortedactivitiesmodel.cpp
index 7b22029e3a..bcefab9d6c 100644
--- a/imports/activitymanager/sortedactivitiesmodel.cpp
+++ b/imports/activitymanager/sortedactivitiesmodel.cpp
@@ -295,7 +295,7 @@ QVariant SortedActivitiesModel::data(const QModelIndex &index, int role) const
             return QVariant(time);
 
         } else {
-            const auto now = QDateTime::currentDateTime().toSecsSinceEpoch();
+            const auto now = QDateTime::currentSecsSinceEpoch();
 
             if (time == 0)
                 return i18n("Used some time ago");
diff --git a/imports/activitymanager/switcherbackend.cpp b/imports/activitymanager/switcherbackend.cpp
index de48382ba9..6a17827da2 100644
--- a/imports/activitymanager/switcherbackend.cpp
+++ b/imports/activitymanager/switcherbackend.cpp
@@ -300,7 +300,7 @@ void SwitcherBackend::onCurrentActivityChanged(const QString &id)
     KConfig config(QStringLiteral("plasma/activitiesstaterc"), KConfig::SimpleConfig, QStandardPaths::GenericStateLocation);
     KConfigGroup times(&config, QStringLiteral("LastUsed"));
 
-    const auto now = QDateTime::currentDateTime().toSecsSinceEpoch();
+    const auto now = QDateTime::currentSecsSinceEpoch();
 
     // Updating the time for the activity we just switched to
     // in the case we do not power off properly, and on the next
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.