summaryrefslogtreecommitdiff
path: root/fetchpostsaction.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-04 23:37:52 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-04 23:37:52 +0200
commit37139c96f04f781b053feefdbb5b3d28b2bcfc11 (patch)
treec6a5bd9557a0442e6b5ad6fa3bae86803339cf32 /fetchpostsaction.cpp
parent3f3a98b7e49230aabd0e557ea59e89e20537ca8a (diff)
downloadtapasboard-37139c96f04f781b053feefdbb5b3d28b2bcfc11.tar.gz
tapasboard-37139c96f04f781b053feefdbb5b3d28b2bcfc11.zip
fix timezones on real device
Diffstat (limited to 'fetchpostsaction.cpp')
-rw-r--r--fetchpostsaction.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/fetchpostsaction.cpp b/fetchpostsaction.cpp
index 1330f44..dbfaf41 100644
--- a/fetchpostsaction.cpp
+++ b/fetchpostsaction.cpp
@@ -132,9 +132,9 @@ void FetchPostsAction::handleFinishedCall()
query.bindValue(":post_author_name", unencodePostText(post["post_author_name"]));
query.bindValue(":can_edit", post["can_edit"].toBool() ? 1 : 0);
query.bindValue(":icon_url", post["icon_url"].toString());
- query.bindValue(":post_time", post["post_time"].toDateTime());
+ query.bindValue(":post_time", unencodeDateTime(post["post_time"]));
query.bindValue(":position", position);
- query.bindValue(":last_update_time", QDateTime::currentDateTime());
+ query.bindValue(":last_update_time", QDateTime::currentDateTimeUtc());
Q_ASSERT(position < total_post_num);
@@ -197,3 +197,10 @@ QString FetchPostsAction::unencodePostContent(const QVariant &v)
QString richText = _board->bbcodeToRichText(unencodePostText(v));
return _board->parseSmilies(richText);
}
+
+QDateTime FetchPostsAction::unencodeDateTime(const QVariant &v)
+{
+ QDateTime dt = v.toDateTime();
+ dt.setTimeSpec(Qt::UTC);
+ return dt;
+}