- QDateTime time = QDateTime::fromTime_t(unixtime).toUTC();
- displayMsg(e, Message::Topic, tr("Channel %1 created on %2")
- .arg(channel, time.toString("yyyy-MM-dd hh:mm:ss UTC")),
- QString(), channel);
+ // Time in IRC protocol is defined as seconds. Convert from seconds instead.
+ // See https://doc.qt.io/qt-5/qdatetime.html#fromSecsSinceEpoch
+#if QT_VERSION >= 0x050800
+ QDateTime time = QDateTime::fromSecsSinceEpoch(unixtime).toUTC();
+#else
+ // fromSecsSinceEpoch() was added in Qt 5.8. Manually downconvert to seconds for now.
+ // See https://doc.qt.io/qt-5/qdatetime.html#fromMSecsSinceEpoch
+ QDateTime time = QDateTime::fromMSecsSinceEpoch((qint64)(unixtime * 1000)).toUTC();
+#endif
+ displayMsg(e, Message::Topic, tr("Channel %1 created on %2").arg(channel, time.toString("yyyy-MM-dd hh:mm:ss UTC")), QString(), channel);