diff options
Diffstat (limited to 'src/corelib/tools/qtimezoneprivate_tz.cpp')
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_tz.cpp | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index 1714c9802f..521475c2dd 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -134,8 +134,6 @@ struct QTzType { int tz_gmtoff; // UTC offset in seconds bool tz_isdst; // Is DST quint8 tz_abbrind; // abbreviation list index - bool tz_ttisgmt; // Is in UTC time - bool tz_ttisstd; // Is in Standard time }; Q_DECLARE_TYPEINFO(QTzType, Q_PRIMITIVE_TYPE); @@ -234,9 +232,6 @@ static QVector<QTzType> parseTzTypes(QDataStream &ds, int tzh_typecnt) // Parse Abbreviation Array Index, 1 byte if (ds.status() == QDataStream::Ok) ds >> type.tz_abbrind; - // Set defaults in case not populated later - type.tz_ttisgmt = false; - type.tz_ttisstd = false; if (ds.status() != QDataStream::Ok) types.resize(i); } @@ -302,20 +297,24 @@ static QVector<QTzType> parseTzIndicators(QDataStream &ds, const QVector<QTzType { QVector<QTzType> result = types; bool temp; - - // Parse tzh_ttisstdcnt x 1-byte standard/wall indicators - for (int i = 0; i < tzh_ttisstdcnt && ds.status() == QDataStream::Ok; ++i) { + /* + Scan and discard indicators. + + These indicators are only of use (by the date program) when "handling + POSIX-style time zone environment variables". The flags here say whether + the *specification* of the zone gave the time in UTC, local standard time + or local wall time; but whatever was specified has been digested for us, + already, by the zone-info compiler (zic), so that the tz_time values read + from the file (by parseTzTransitions) are all in UTC. + */ + + // Scan tzh_ttisstdcnt x 1-byte standard/wall indicators + for (int i = 0; i < tzh_ttisstdcnt && ds.status() == QDataStream::Ok; ++i) ds >> temp; - if (ds.status() == QDataStream::Ok) - result[i].tz_ttisstd = temp; - } - // Parse tzh_ttisgmtcnt x 1-byte UTC/local indicators - for (int i = 0; i < tzh_ttisgmtcnt && ds.status() == QDataStream::Ok; ++i) { + // Scan tzh_ttisgmtcnt x 1-byte UTC/local indicators + for (int i = 0; i < tzh_ttisgmtcnt && ds.status() == QDataStream::Ok; ++i) ds >> temp; - if (ds.status() == QDataStream::Ok) - result[i].tz_ttisgmt = temp; - } return result; } @@ -790,14 +789,7 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId) tran.ruleIndex = ruleIndex; } - // TODO convert to UTC if not in UTC - if (tz_type.tz_ttisgmt) - tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000; - else if (tz_type.tz_ttisstd) - tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000; - else - tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000; - + tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000; m_tranTimes.append(tran); } |