summaryrefslogtreecommitdiff
path: root/saltoqd/systemmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'saltoqd/systemmanager.cpp')
-rw-r--r--saltoqd/systemmanager.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/saltoqd/systemmanager.cpp b/saltoqd/systemmanager.cpp
index 4f74ea4..ac0c5b5 100644
--- a/saltoqd/systemmanager.cpp
+++ b/saltoqd/systemmanager.cpp
@@ -1,5 +1,4 @@
-#include <QtCore/QDateTime>
-#include <QtCore/QTimeZone>
+#include <time.h>
#include "systemmanager.h"
#include "voicecallmanager.h"
@@ -27,17 +26,21 @@ void SystemManager::handleMessage(const ToqConnection::Message &msg)
void SystemManager::handleGetTimeMessage(const ToqConnection::Message &msg)
{
- QJsonObject reply, time;
- QDateTime dt = QDateTime::currentDateTime();
- QTimeZone tz = dt.timeZone();
+ QJsonObject reply, detail;
- time.insert("epoch_time", qint64(dt.toTime_t()));
- time.insert("time_zone", tz.standardTimeOffset(dt));
- time.insert("dst", tz.isDaylightTime(dt) ? 1 : 0);
+ // Seems that QTimeZone is completely broken on Jolla ("timed/localtime")
+ time_t now;
+ tm now_info;
+ time(&now);
+ localtime_r(&now, &now_info);
+
+ detail.insert("epoch_time", qint64(now));
+ detail.insert("time_zone", int(now_info.tm_gmtoff));
+ detail.insert("dst", int(now_info.tm_isdst));
reply.insert("result", int(0));
reply.insert("description", QLatin1String("current time"));
- reply.insert("time", time);
+ reply.insert("time", detail);
_toq->sendReply(msg, 0x4000, reply);
}