This at least partly fixes #42 ("fun with time zones").
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 2 May 2012 21:45:10 +0000 (21:45 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 2 May 2012 21:45:10 +0000 (21:45 +0000)
src/orm/ormrecord.h

index 49c83c8..73541e2 100644 (file)
@@ -215,7 +215,9 @@ QVariant OrmRecord<T>::convertToDb(QVariant value, QVariant::Type colType)
 {
     if (colType == QVariant::DateTime && value.canConvert<QDateTime>())
     {
-        return value.toDateTime().toTime_t();
+        QDateTime dateTime = value.toDateTime();
+        dateTime.setTimeSpec(Qt::UTC); // this is to avoid that dateTime.toTime_t changes the time depending on the local time zone
+        return dateTime.toTime_t();
     }
 
     return value;