13 #ifndef TIME_ZONE_DATA_H
14 #define TIME_ZONE_DATA_H
22 #if defined(TZ_LIBRARY_BUILD)
23 # define TZLIB_EXPORT Q_DECL_EXPORT
25 # define TZLIB_EXPORT Q_DECL_IMPORT
67 TimeStamp(qint64 ts,quint16 msec,
bool isLocal=
true);
75 TimeStamp(
const QDate&,
bool isLocal=
true);
80 TimeStamp(
const QTime&,
bool isLocal=
true);
90 TimeStamp(
const QDateTime&ts,
bool isLocal);
104 bool setZone(QString);
115 bool moveToZone(QString);
124 QString
zone()
const{
return m_zone;}
136 QDate
toDate()
const{
return QDate(m_year,m_month,m_day);}
138 operator QDate()
const{
return QDate(m_year,m_month,m_day);}
141 QTime
toTime()
const{
return QTime(m_hour,m_min,m_sec,m_msec);}
143 operator QTime()
const{
return QTime(m_hour,m_min,m_sec,m_msec);}
146 QDateTime toDateTime()
const;
148 operator QDateTime()
const{
return toDateTime();}
156 void addMSecs(
int msec);
159 void addSecs(
int sec);
168 qint16
year()
const{
return m_year;}
170 quint8
month()
const{
return m_month;}
172 quint8
day()
const{
return m_day;}
174 quint8
hour()
const{
return m_hour;}
180 quint16
msecs()
const{
return m_msec;}
183 WeekDay weekDay()
const;
186 QString zoneAbbreviation()
const;
189 QString toISO()
const;
197 {
return m_unix==ts.m_unix && m_msec==ts.m_msec;}
200 {
return m_unix!=ts.m_unix || m_msec!=ts.m_msec;}
204 {
return m_unix<ts.m_unix || (m_unix==ts.m_unix && m_msec<ts.m_msec);}
207 {
return m_unix<ts.m_unix || (m_unix==ts.m_unix && m_msec<=ts.m_msec);}
211 {
return m_unix>ts.m_unix || (m_unix==ts.m_unix && m_msec>ts.m_msec);}
214 {
return m_unix>ts.m_unix || (m_unix==ts.m_unix && m_msec>=ts.m_msec);}
220 {
return TimeStamp(QDate(year,month,day),isLocal);}
226 {
return TimeStamp(QDate(year,month,day),zone);}
233 {
return TimeStamp(QTime(hour,minute),isLocal);}
236 {
return TimeStamp(QTime(hour,minute,second),isLocal);}
239 {
return TimeStamp(QTime(hour,minute),zone);}
242 {
return TimeStamp(QTime(hour,minute,second),zone);}
265 {
return TimeStamp(QDateTime(dt,tm),isLocal);}
268 {
return TimeStamp(QDateTime(dt,tm),zone);}
272 {
return fromDateTime(QDate(year,month,day),QTime(hour,minute),isLocal);}
274 static TimeStamp fromDateTime(
int year,quint8 month,quint8 day,quint8 hour,quint8 minute,quint8 second,
bool isLocal=
true)
275 {
return fromDateTime(QDate(year,month,day),QTime(hour,minute,second),isLocal);}
285 static void setSearchPath(
const QStringList&);
288 static void resetRepository();
293 static bool setDefaultZone(QString
zone);
296 static QString defaultZone();
299 static void storeDefaultZone();
302 static void forgetDefaultZone();
305 static bool loadZone(QString
zone);
308 static QString systemLocalZone();
329 quint8 m_month,m_day,m_hour,m_min,m_sec;
332 void recalcToCached();
static TimeStamp fromTime(quint8 hour, quint8 minute, QString zone)
Definition: tzdata.h:238
static TimeStamp fromTime(QTime tm, bool isLocal=true)
Definition: tzdata.h:244
static TimeStamp fromDate(int year, quint8 month, quint8 day, bool isLocal=true)
Definition: tzdata.h:219
static TimeStamp fromDateTime(QDate dt, QTime tm)
Definition: tzdata.h:261
bool operator<=(const TimeStamp &ts) const
Definition: tzdata.h:206
static TimeStamp fromDateTime(int year, quint8 month, quint8 day, quint8 hour, quint8 minute, quint8 second, bool isLocal=true)
Definition: tzdata.h:274
QTime toTime() const
Definition: tzdata.h:141
static TimeStamp fromDateTime(QDate dt, QTime tm, bool isLocal)
Definition: tzdata.h:264
static TimeStamp fromDateTime(QDateTime dt, QString zone)
Definition: tzdata.h:257
static TimeStamp fromDateTime(QDate dt, QTime tm, QString zone)
Definition: tzdata.h:267
static TimeStamp now(QString zone)
Definition: tzdata.h:279
static TimeStamp fromTime(quint8 hour, quint8 minute, quint8 second, QString zone)
Definition: tzdata.h:241
qint64 toUnix() const
Definition: tzdata.h:165
TimeStamp toZone(QString zone) const
Definition: tzdata.h:133
quint8 minute() const
Definition: tzdata.h:176
void setUTC()
Definition: tzdata.h:110
bool operator<(const TimeStamp &ts) const
Definition: tzdata.h:203
static TimeStamp fromDateTime(QDateTime dt)
Definition: tzdata.h:251
bool operator!=(const TimeStamp &ts) const
Definition: tzdata.h:199
quint8 hour() const
Definition: tzdata.h:174
bool operator>(const TimeStamp &ts) const
Definition: tzdata.h:210
qint32 offsetFromUTC() const
Definition: tzdata.h:193
quint8 second() const
Definition: tzdata.h:178
static TimeStamp now(bool isLocal=true)
Definition: tzdata.h:282
TimeStamp toUTC() const
Definition: tzdata.h:127
QDateTime toSystemDateTime() const
Definition: tzdata.h:153
static TimeStamp fromDate(QDate dt, QString zone)
Definition: tzdata.h:228
#define TZLIB_EXPORT
Definition: tzdata.h:25
QString zone() const
Definition: tzdata.h:124
static TimeStamp fromDateTime(QDateTime dt, bool isLocal)
Definition: tzdata.h:254
quint16 msecs() const
Definition: tzdata.h:180
static TimeStamp fromDateTime(int year, quint8 month, quint8 day, quint8 hour, quint8 minute, bool isLocal=true)
Definition: tzdata.h:271
static TimeStamp fromTime(QTime tm, QString zone)
Definition: tzdata.h:247
void setLocal()
Definition: tzdata.h:107
QDate toDate() const
Definition: tzdata.h:136
Definition: include/tzfile.h:149
static TimeStamp fromTime(quint8 hour, quint8 minute, quint8 second, bool isLocal=true)
Definition: tzdata.h:235
TimeStamp toLocal() const
Definition: tzdata.h:130
WeekDay
Definition: tzdata.h:42
static TimeStamp fromDate(int year, quint8 month, quint8 day, QString zone)
Definition: tzdata.h:225
static TimeStamp fromTime(quint8 hour, quint8 minute, bool isLocal=true)
Definition: tzdata.h:232
bool operator>=(const TimeStamp &ts) const
Definition: tzdata.h:213
quint8 month() const
Definition: tzdata.h:170
static TimeStamp fromDate(QDate dt, bool isLocal=true)
Definition: tzdata.h:222
QDateTime toSystemDateTimeUTC() const
Definition: tzdata.h:151
static struct tm tm
Definition: localtime.c:189
quint8 day() const
Definition: tzdata.h:172
void moveToLocal()
Definition: tzdata.h:121
qint16 year() const
Definition: tzdata.h:168
void moveToUTC()
Definition: tzdata.h:118
bool operator==(const TimeStamp &ts) const
Definition: tzdata.h:196