diff options
author | John Layt <jlayt@kde.org> | 2013-02-11 13:44:37 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-23 01:14:03 +0200 |
commit | 55f5b29d7975d7e642ec258e44ca23726e1dfa0d (patch) | |
tree | a962c946ed58690d67bba1982556f3cb97545969 /src/corelib/tools/qdatetime_p.h | |
parent | 8af776d4140c19baccb8e2767ed8b57cc79ccb06 (diff) |
QDateTime - Add QTimeZone support
Add support to QDateTime for time zones using the new QTimeZone class.
[ChangeLog][QtCore][QDateTime] Add support for a new Qt::TimeZone
spec to be used with QTimeZone to define times in a specific
time zone.
Change-Id: I21bfa52a8ba8989b55bb74e025d1f2b2b623b2a7
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.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h index 7fd36bc4e0..f52108d764 100644 --- a/src/corelib/tools/qdatetime_p.h +++ b/src/corelib/tools/qdatetime_p.h @@ -57,6 +57,8 @@ #include "QtCore/qatomic.h" #include "QtCore/qdatetime.h" +#include "qtimezone.h" + QT_BEGIN_NAMESPACE class QDateTimePrivate : public QSharedData @@ -69,7 +71,8 @@ public: LocalStandard = 0, LocalDST = 1, UTC = 2, - OffsetFromUTC = 3 + OffsetFromUTC = 3, + TimeZone = 4 }; // Daylight Time Status @@ -86,7 +89,8 @@ public: NullTime = 0x02, ValidDate = 0x04, ValidTime = 0x08, - ValidDateTime = 0x10 + ValidDateTime = 0x10, + TimeZoneCached = 0x20 }; Q_DECLARE_FLAGS(StatusFlags, StatusFlag) @@ -99,16 +103,26 @@ public: QDateTimePrivate(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec, int offsetSeconds); +#ifndef QT_BOOTSTRAPPED + QDateTimePrivate(const QDate &toDate, const QTime &toTime, const QTimeZone & timeZone); +#endif // QT_BOOTSTRAPPED + QDateTimePrivate(const QDateTimePrivate &other) : QSharedData(other), m_msecs(other.m_msecs), m_spec(other.m_spec), m_offsetFromUtc(other.m_offsetFromUtc), +#ifndef QT_BOOTSTRAPPED + m_timeZone(other.m_timeZone), +#endif // QT_BOOTSTRAPPED m_status(other.m_status) {} qint64 m_msecs; Qt::TimeSpec m_spec; int m_offsetFromUtc; +#ifndef QT_BOOTSTRAPPED + QTimeZone m_timeZone; +#endif // QT_BOOTSTRAPPED StatusFlags m_status; void setTimeSpec(Qt::TimeSpec spec, int offsetSeconds); @@ -129,6 +143,14 @@ public: inline bool isValidDateTime() const { return (m_status & ValidDateTime) == ValidDateTime; } inline void setValidDateTime() { m_status = m_status | ValidDateTime; } inline void clearValidDateTime() { m_status = m_status & ~ValidDateTime; } + inline bool isTimeZoneCached() const { return (m_status & TimeZoneCached) == TimeZoneCached; } + inline void setTimeZoneCached() { m_status = m_status | TimeZoneCached; } + inline void clearTimeZoneCached() { m_status = m_status & ~TimeZoneCached; } + +#ifndef QT_BOOTSTRAPPED + static qint64 zoneMSecsToEpochMSecs(qint64 msecs, const QTimeZone &zone, + QDate *localDate, QTime *localTime); +#endif // QT_BOOTSTRAPPED static inline qint64 minJd() { return QDate::minJd(); } static inline qint64 maxJd() { return QDate::maxJd(); } |