Address Qt 6.7 deprecation warning

See https://doc.qt.io/qt-6.7/qdatetime-obsolete.html#setTimeSpec
This commit is contained in:
Juergen Spitzmueller 2024-10-19 09:57:24 +02:00
parent d5ade099cf
commit 4d51a05ce4

View File

@ -19,6 +19,9 @@
#include <QDateTime> #include <QDateTime>
#include <QLocale> #include <QLocale>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
#include <QTimeZone>
#endif
using namespace std; using namespace std;
@ -69,7 +72,11 @@ time_t from_asctime_utc(string t)
<< "´ (invalid format)"); << "´ (invalid format)");
return static_cast<time_t>(-1); return static_cast<time_t>(-1);
} }
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
loc_dt.setTimeZone(QTimeZone(QTimeZone::UTC));
#else
loc_dt.setTimeSpec(Qt::UTC); loc_dt.setTimeSpec(Qt::UTC);
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
return loc_dt.toSecsSinceEpoch(); return loc_dt.toSecsSinceEpoch();
#else #else