summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetime_p.h
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-08-12 14:20:56 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-14 18:31:00 +0200
commit6c3a9df3fee0dc387bde3e16d185952ade4ea2fd (patch)
tree29041a99f28b1cbb11dae44463d45a4e3c8d8970 /src/corelib/tools/qdatetime_p.h
parente76c312eb84cb5d9971b024c411472dda4bbf8aa (diff)
QDateTime - Store Qt::TimeSpec, remove Daylight Status
Change storing the spec from QDateTimePrivate::Spec to Qt::TimeSpec. Remove the storage and use of the Daylight Status as it is almost never set or used, and would be inaccurate if the tz were to change. It will be replaced later with proper daylight transition support. This simplifies the code and makes the msecs storage change easier. Change-Id: I78a70905025d7eddf1c2dc6001f6b490e5a2b3b8 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qdatetime_p.h')
-rw-r--r--src/corelib/tools/qdatetime_p.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index f765403d37..e6cece141d 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -62,19 +62,35 @@ QT_BEGIN_NAMESPACE
class QDateTimePrivate : public QSharedData
{
public:
- enum Spec { LocalUnknown = -1, LocalStandard = 0, LocalDST = 1, UTC = 2, OffsetFromUTC = 3};
+ // Never change or delete this enum, it is required for backwards compatible
+ // serialization of QDateTime before 5.2, so is essentially public API
+ enum Spec {
+ LocalUnknown = -1,
+ LocalStandard = 0,
+ LocalDST = 1,
+ UTC = 2,
+ OffsetFromUTC = 3
+ };
- QDateTimePrivate() : spec(LocalUnknown), m_offsetFromUtc(0) {}
+ // Daylight Time Status
+ enum DaylightStatus {
+ NoDaylightTime,
+ UnknownDaylightTime,
+ StandardTime,
+ DaylightTime
+ };
+
+ QDateTimePrivate() : m_spec(Qt::LocalTime), m_offsetFromUtc(0) {}
QDateTimePrivate(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec,
int offsetSeconds);
QDateTimePrivate(const QDateTimePrivate &other)
- : QSharedData(other), date(other.date), time(other.time), spec(other.spec),
+ : QSharedData(other), date(other.date), time(other.time), m_spec(other.m_spec),
m_offsetFromUtc(other.m_offsetFromUtc)
{}
QDate date;
QTime time;
- Spec spec;
+ Qt::TimeSpec m_spec;
int m_offsetFromUtc;
// Get current date/time in LocalTime and put result in outDate and outTime
@@ -85,6 +101,8 @@ public:
// Add msecs to given datetime and put result in utcDate and utcTime
static void addMSecs(QDate &utcDate, QTime &utcTime, qint64 msecs);
+ void setTimeSpec(Qt::TimeSpec spec, int offsetSeconds);
+
static inline qint64 minJd() { return QDate::minJd(); }
static inline qint64 maxJd() { return QDate::maxJd(); }
};