Changeset View
Changeset View
Standalone View
Standalone View
dataengines/time/timeengine.cpp
Show All 19 Lines | |||||
20 | 20 | | |||
21 | #include "timeengine.h" | 21 | #include "timeengine.h" | ||
22 | 22 | | |||
23 | #include <QDate> | 23 | #include <QDate> | ||
24 | #include <QDBusConnection> | 24 | #include <QDBusConnection> | ||
25 | #include <QStringList> | 25 | #include <QStringList> | ||
26 | #include <QTime> | 26 | #include <QTime> | ||
27 | #include <QSocketNotifier> | 27 | #include <QSocketNotifier> | ||
28 | #include <QTimeZone> | | |||
29 | | ||||
30 | #include <Solid/PowerManagement> | | |||
31 | 28 | | |||
32 | #ifdef Q_OS_LINUX | 29 | #ifdef Q_OS_LINUX | ||
33 | #include <sys/timerfd.h> | 30 | #include <sys/timerfd.h> | ||
34 | #include <unistd.h> | 31 | #include <unistd.h> | ||
35 | #include <fcntl.h> | 32 | #include <fcntl.h> | ||
36 | #endif | 33 | #endif | ||
37 | 34 | | |||
38 | #include "timesource.h" | 35 | #include "timesource.h" | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 64 | #ifdef Q_OS_LINUX | |||
83 | auto notifier = new QSocketNotifier(timeChangedFd, QSocketNotifier::Read, this); | 80 | auto notifier = new QSocketNotifier(timeChangedFd, QSocketNotifier::Read, this); | ||
84 | connect(notifier, &QSocketNotifier::activated, this, [this](int fd) { | 81 | connect(notifier, &QSocketNotifier::activated, this, [this](int fd) { | ||
85 | uint64_t c; | 82 | uint64_t c; | ||
86 | read(fd, &c, 8); | 83 | read(fd, &c, 8); | ||
87 | clockSkewed(); | 84 | clockSkewed(); | ||
88 | }); | 85 | }); | ||
89 | #else | 86 | #else | ||
90 | dbus.connect(QString(), "/org/kde/kcmshell_clock", "org.kde.kcmshell_clock", "clockUpdated", this, SLOT(clockSkewed())); | 87 | dbus.connect(QString(), "/org/kde/kcmshell_clock", "org.kde.kcmshell_clock", "clockUpdated", this, SLOT(clockSkewed())); | ||
91 | connect( Solid::PowerManagement::notifier(), SIGNAL(resumingFromSuspend()), this , SLOT(clockSkewed()) ); | 88 | dbus.connect(QStringLiteral("org.kde.Solid.PowerManagement"), | ||
89 | QStringLiteral("/org/kde/Solid/PowerManagement/Actions/SuspendSession"), | ||||
90 | QStringLiteral("org.kde.Solid.PowerManagement.Actions.SuspendSession"), | ||||
91 | QStringLiteral("resumingFromSuspend"), | ||||
92 | this, | ||||
93 | SLOT(clockSkewed())); | ||||
92 | #endif | 94 | #endif | ||
93 | } | 95 | } | ||
94 | 96 | | |||
95 | void TimeEngine::clockSkewed() | 97 | void TimeEngine::clockSkewed() | ||
96 | { | 98 | { | ||
97 | qDebug() << "Time engine Clock skew signaled"; | 99 | qDebug() << "Time engine Clock skew signaled"; | ||
98 | updateAllSources(); | 100 | updateAllSources(); | ||
99 | forceImmediateUpdateOfAllVisualizations(); | 101 | forceImmediateUpdateOfAllVisualizations(); | ||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |