summaryrefslogtreecommitdiffstats
path: root/common/typeindex.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-12 14:26:07 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-12 14:26:07 +0200
commit85a4d5ac9561b639c47721e4e2305b6ced6be261 (patch)
treebf75b2e6938121c0165bdc14081582fbc33de0de /common/typeindex.cpp
parentb9af56291f5bfc898ce232b4ebf5065554484962 (diff)
downloadsink-85a4d5ac9561b639c47721e4e2305b6ced6be261.tar.gz
sink-85a4d5ac9561b639c47721e4e2305b6ced6be261.zip
QDateTime::toString is really slow
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r--common/typeindex.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp
index b8845b7..113c209 100644
--- a/common/typeindex.cpp
+++ b/common/typeindex.cpp
@@ -21,16 +21,16 @@
21#include "log.h" 21#include "log.h"
22#include "index.h" 22#include "index.h"
23#include <QDateTime> 23#include <QDateTime>
24#include <QDataStream>
24 25
25using namespace Sink; 26using namespace Sink;
26 27
27static QByteArray getByteArray(const QVariant &value) 28static QByteArray getByteArray(const QVariant &value)
28{ 29{
29 if (value.type() == QVariant::DateTime) { 30 if (value.type() == QVariant::DateTime) {
30 const auto result = value.toDateTime().toString().toLatin1(); 31 QByteArray result;
31 if (result.isEmpty()) { 32 QDataStream ds(&result, QIODevice::WriteOnly);
32 return "nodate"; 33 ds << value.toDateTime();
33 }
34 return result; 34 return result;
35 } 35 }
36 if (value.type() == QVariant::Bool) { 36 if (value.type() == QVariant::Bool) {