From 64a3bba7b8f0a59a57d8249c266d3eb6c408a761 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Jan 2018 23:32:58 -0800 Subject: QVariant: convert QDateTime and QTime to string with milliseconds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way, it's lossless. This commit is a cherry-pick of ab1e50757454b5afda2f6dec52d2eb16a32d4798, which was reverted. [ChangeLog][QtCore][QVariant] Conversions of QDateTime to strings now contain the millisecond components. Change-Id: I5e421e32396d44e4b39efffd150b744e40fff3a1 Reviewed-by: Lars Knoll Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qvariant.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 9473ecbdf5..6fcc6b8d30 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -440,10 +440,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) *str = v_cast(d)->toString(Qt::ISODate); break; case QVariant::Time: - *str = v_cast(d)->toString(Qt::ISODate); + *str = v_cast(d)->toString(Qt::ISODateWithMs); break; case QVariant::DateTime: - *str = v_cast(d)->toString(Qt::ISODate); + *str = v_cast(d)->toString(Qt::ISODateWithMs); break; #endif case QVariant::Bool: -- cgit v1.2.3