summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-30 19:57:37 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-05-08 05:03:24 +0000
commitb491fab02a6a67fcd18d8076ac802d2f8c4f6972 (patch)
tree81198e7f2552cadfdd2573703dc962522d4e3af7 /src/corelib
parentf402b4886d05f5d6e55f04377dc49135a9e109c3 (diff)
QDateTime: Remove the distinction between null and invalid date and time
Change-Id: Id5480807d25e49e78b79ffff144a523e6851c03f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qdatetime.cpp6
-rw-r--r--src/corelib/tools/qdatetime_p.h4
2 files changed, 3 insertions, 7 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 5dbf68fc81..6aae979835 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2546,15 +2546,13 @@ void QDateTimePrivate::setDateTime(const QDate &date, const QTime &time)
if (!useTime.isValid() && date.isValid())
useTime = QTime::fromMSecsSinceStartOfDay(0);
- StatusFlags newStatus;
+ StatusFlags newStatus = 0;
// Set date value and status
qint64 days = 0;
if (date.isValid()) {
days = date.toJulianDay() - JULIAN_DAY_FOR_EPOCH;
newStatus = ValidDate;
- } else if (date.isNull()) {
- newStatus = NullDate;
}
// Set time value and status
@@ -2562,8 +2560,6 @@ void QDateTimePrivate::setDateTime(const QDate &date, const QTime &time)
if (useTime.isValid()) {
ds = useTime.msecsSinceStartOfDay();
newStatus |= ValidTime;
- } else if (time.isNull()) {
- newStatus |= NullTime;
}
// Set msecs serial value
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index 36e95e37cd..fd55575834 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -131,8 +131,8 @@ public:
void refreshDateTime();
// Get/set date and time status
- inline bool isNullDate() const { return m_status & NullDate; }
- inline bool isNullTime() const { return m_status & NullTime; }
+ inline bool isNullDate() const { return !(m_status & ValidDate); }
+ inline bool isNullTime() const { return !(m_status & ValidTime); }
inline bool isValidDate() const { return m_status & ValidDate; }
inline bool isValidTime() const { return m_status & ValidTime; }
inline bool isValidDateTime() const { return m_status & ValidDateTime; }