From 4d24fcd3e1dce6c56d9fc70ee386dcc8aa552ef6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 May 2021 21:44:51 -0700 Subject: [PATCH] QDateTime: fix our oversight in Qt 6.0 not changing the ShortData For 32-bit systems. They're not important (to me), but might as well fix this oversight. Change-Id: I755911ae7d0341f49039fffd167b26617db93354 Reviewed-by: Edward Welbourne --- src/corelib/time/qdatetime.cpp | 6 +++++- src/corelib/time/qdatetime.h | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index faf3fe38de..369b04c751 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2021 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -3454,6 +3454,10 @@ inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QT */ QDateTime::QDateTime() noexcept { +#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) || QT_POINTER_SIZE == 8 + static_assert(sizeof(ShortData) == sizeof(qint64)); + static_assert(sizeof(Data) == sizeof(qint64)); +#endif } /*! diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index bc8c09b1e9..80227afde2 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2021 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -240,8 +240,12 @@ class Q_CORE_EXPORT QDateTime #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN quintptr status : 8; #endif +#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) + qint64 msecs : 56; +#else // note: this is only 24 bits on 32-bit systems... qintptr msecs : sizeof(void *) * 8 - 8; +#endif #if Q_BYTE_ORDER == Q_BIG_ENDIAN quintptr status : 8;