diff options
Diffstat (limited to 'odb/qt/date-time/sqlite/qdate-time-traits.hxx')
-rw-r--r-- | odb/qt/date-time/sqlite/qdate-time-traits.hxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/odb/qt/date-time/sqlite/qdate-time-traits.hxx b/odb/qt/date-time/sqlite/qdate-time-traits.hxx index 2c08b29..db561fc 100644 --- a/odb/qt/date-time/sqlite/qdate-time-traits.hxx +++ b/odb/qt/date-time/sqlite/qdate-time-traits.hxx @@ -1,5 +1,4 @@ // file : odb/qt/date-time/sqlite/qdatetime-traits.hxx -// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file #ifndef ODB_QT_DATE_TIME_SQLITE_QDATETIME_TRAITS_HXX @@ -11,6 +10,8 @@ #include <cstddef> // std::size_t #include <cstring> // std::memcpy +#include <QtCore/QtGlobal> // QT_VERSION + #include <QtCore/QDateTime> #include <odb/details/buffer.hxx> @@ -91,7 +92,14 @@ namespace odb else { v.setTimeSpec (Qt::UTC); - v.setTime_t (static_cast <uint> (i)); + + // *Time_t() functions are deprecated in favor of *SecsSinceEpoch(). + // +#if QT_VERSION < 0x060000 + v.setTime_t (static_cast<uint> (i)); +#else + v.setSecsSinceEpoch (static_cast<qint64> (i)); +#endif } } @@ -107,7 +115,12 @@ namespace odb else { is_null = false; + +#if QT_VERSION < 0x060000 i = static_cast<long long> (v.toTime_t ()); +#else + i = static_cast<long long> (v.toSecsSinceEpoch ()); +#endif } } }; |