qtimezoneprivate_tz.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15struct QTzTimeZone {-
16 QLocale::Country country;-
17 QByteArray comment;-
18};-
19-
20-
21typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;-
22-
23-
24static QTzTimeZoneHash loadTzTimeZones()-
25{-
26 QString path = ([]() -> QString { enum { Size = sizeof(u"" "/usr/share/zoneinfo/zone.tab")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/usr/share/zoneinfo/zone.tab" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 1 time by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QTimeZone
qstring_literal_temp;
executed 1 time by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QTimeZone
}());
1
27 if (!QFile::exists(path)
!QFile::exists(path)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-1
28 path = ([]() -> QString { enum { Size = sizeof(u"" "/usr/lib/zoneinfo/zone.tab")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/usr/lib/zoneinfo/zone.tab" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}());
never executed: path = ([]() -> QString { enum { Size = sizeof(u"" "/usr/lib/zoneinfo/zone.tab")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/usr/lib/zoneinfo/zone.tab" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
0
29-
30 QFile tzif(path);-
31 if (!tzif.open(QIODevice::ReadOnly)
!tzif.open(QIO...ice::ReadOnly)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-1
32 return
never executed: return QTzTimeZoneHash();
QTzTimeZoneHash();
never executed: return QTzTimeZoneHash();
0
33-
34 QTzTimeZoneHash zonesHash;-
35-
36 QTextStream ts(&tzif);-
37 while (!ts.atEnd()
!ts.atEnd()Description
TRUEevaluated 445 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
) {
1-445
38 const QString line = ts.readLine();-
39-
40 if (!line.isEmpty()
!line.isEmpty()Description
TRUEevaluated 445 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
&& line.at(0) != '#'
line.at(0) != '#'Description
TRUEevaluated 421 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
0-445
41-
42 const auto parts = line.splitRef(QLatin1Char('\t'));-
43 QTzTimeZone zone;-
44 zone.country = QLocalePrivate::codeToCountry(parts.at(0));-
45 if (parts.size() > 3
parts.size() > 3Description
TRUEevaluated 204 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 217 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
204-217
46 zone.comment = parts.at(3).toUtf8();
executed 204 times by 1 test: zone.comment = parts.at(3).toUtf8();
Executed by:
  • tst_QTimeZone
204
47 zonesHash.insert(parts.at(2).toUtf8(), zone);-
48 }
executed 421 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
421
49 }
executed 445 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
445
50 return
executed 1 time by 1 test: return zonesHash;
Executed by:
  • tst_QTimeZone
zonesHash;
executed 1 time by 1 test: return zonesHash;
Executed by:
  • tst_QTimeZone
1
51}-
52-
53-
54namespace { namespace Q_QGS_tzZones { typedef const QTzTimeZoneHash Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qtimezone - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 1 time by 1 test: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qtimezone - unknown status
}
executed 1 time by 1 test: end of block
Executed by:
  • tst_qtimezone - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (loadTzTimeZones()))) : value (loadTzTimeZones()) { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 1313 times by 1 test: return &holder.value;
Executed by:
  • tst_QTimeZone
&holder.value;
executed 1313 times by 1 test: return &holder.value;
Executed by:
  • tst_QTimeZone
} } } static QGlobalStatic<const QTzTimeZoneHash, Q_QGS_tzZones::innerFunction, Q_QGS_tzZones::guard> tzZones;;
0-1313
55struct QTzHeader {-
56 char tzh_magic[4];-
57 char tzh_version;-
58 char tzh_reserved[15];-
59 quint32 tzh_ttisgmtcnt;-
60 quint32 tzh_ttisstdcnt;-
61 quint32 tzh_leapcnt;-
62 quint32 tzh_timecnt;-
63 quint32 tzh_typecnt;-
64 quint32 tzh_charcnt;-
65};-
66-
67struct QTzTransition {-
68 qint64 tz_time;-
69 quint8 tz_typeind;-
70};-
71template<> class QTypeInfo<QTzTransition > { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_PRIMITIVE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QTzTransition)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QTzTransition >::value, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QTzTransition) }; static inline const char *name() { return "QTzTransition"; } };-
72-
73struct QTzType {-
74 int tz_gmtoff;-
75 bool tz_isdst;-
76 quint8 tz_abbrind;-
77 bool tz_ttisgmt;-
78 bool tz_ttisstd;-
79};-
80template<> class QTypeInfo<QTzType > { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_PRIMITIVE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QTzType)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QTzType >::value, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QTzType) }; static inline const char *name() { return "QTzType"; } };-
81-
82-
83-
84-
85static QTzHeader parseTzHeader(QDataStream &ds, bool *ok)-
86{-
87 QTzHeader hdr;-
88 quint8 ch;-
89 *ok = false;-
90-
91-
92 ds.readRawData(hdr.tzh_magic, 4);-
93-
94 if (memcmp(hdr.tzh_magic, "TZif", 4) != 0
memcmp(hdr.tzh...TZif", 4) != 0Description
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
|| ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-908
95 return
never executed: return hdr;
hdr;
never executed: return hdr;
0
96-
97-
98 ds >> ch;-
99 hdr.tzh_version = ch;-
100 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-908
101 || (hdr.tzh_version != '2'
hdr.tzh_version != '2'Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 894 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& hdr.tzh_version != '\0'
hdr.tzh_version != '\0'Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
&& hdr.tzh_version != '3'
hdr.tzh_version != '3'Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QTimeZone
)) {
0-894
102 return
never executed: return hdr;
hdr;
never executed: return hdr;
0
103 }-
104-
105-
106 ds.readRawData(hdr.tzh_reserved, 15);-
107 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-908
108 return
never executed: return hdr;
hdr;
never executed: return hdr;
0
109-
110-
111 ds >> hdr.tzh_ttisgmtcnt >> hdr.tzh_ttisstdcnt >> hdr.tzh_leapcnt >> hdr.tzh_timecnt-
112 >> hdr.tzh_typecnt >> hdr.tzh_charcnt;-
113-
114-
115 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-908
116 || hdr.tzh_timecnt > 1200
hdr.tzh_timecnt > 1200Description
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-908
117 || hdr.tzh_typecnt > 256
hdr.tzh_typecnt > 256Description
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-908
118 || hdr.tzh_charcnt > 50
hdr.tzh_charcnt > 50Description
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-908
119 || hdr.tzh_leapcnt > 50
hdr.tzh_leapcnt > 50Description
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-908
120 || hdr.tzh_ttisgmtcnt > hdr.tzh_typecnt
hdr.tzh_ttisgm...dr.tzh_typecntDescription
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-908
121 || hdr.tzh_ttisstdcnt > hdr.tzh_typecnt
hdr.tzh_ttisst...dr.tzh_typecntDescription
TRUEnever evaluated
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-908
122 return
never executed: return hdr;
hdr;
never executed: return hdr;
0
123 }-
124-
125 *ok = true;-
126 return
executed 908 times by 2 tests: return hdr;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
hdr;
executed 908 times by 2 tests: return hdr;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
908
127}-
128-
129static QVector<QTzTransition> parseTzTransitions(QDataStream &ds, int tzh_timecnt, bool longTran)-
130{-
131 QVector<QTzTransition> transitions(tzh_timecnt);-
132-
133 if (longTran
longTranDescription
TRUEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
454
134-
135 for (int i = 0; i < tzh_timecnt
i < tzh_timecntDescription
TRUEevaluated 31553 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 31553 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-31553
136 ds >> transitions[i].tz_time;-
137 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 31553 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-31553
138 transitions.resize(i);
never executed: transitions.resize(i);
0
139 }
executed 31553 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
31553
140 }
executed 454 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
else {
454
141-
142 int val;-
143 for (int i = 0; i < tzh_timecnt
i < tzh_timecntDescription
TRUEevaluated 31278 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 31278 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-31278
144 ds >> val;-
145 transitions[i].tz_time = val;-
146 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 31278 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-31278
147 transitions.resize(i);
never executed: transitions.resize(i);
0
148 }
executed 31278 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
31278
149 }
executed 454 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
454
150-
151-
152 for (int i = 0; i < tzh_timecnt
i < tzh_timecntDescription
TRUEevaluated 62831 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 62831 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-62831
153 quint8 typeind;-
154 ds >> typeind;-
155 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 62831 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
)
0-62831
156 transitions[i].tz_typeind = typeind;
executed 62831 times by 2 tests: transitions[i].tz_typeind = typeind;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
62831
157 }
executed 62831 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
62831
158-
159 return
executed 908 times by 2 tests: return transitions;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
transitions;
executed 908 times by 2 tests: return transitions;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
908
160}-
161-
162static QVector<QTzType> parseTzTypes(QDataStream &ds, int tzh_typecnt)-
163{-
164 QVector<QTzType> types(tzh_typecnt);-
165-
166-
167 for (int i = 0; i < tzh_typecnt
i < tzh_typecntDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-5130
168 QTzType &type = types[i];-
169-
170 ds >> type.tz_gmtoff;-
171-
172 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
)
0-5130
173 ds >> type.tz_isdst;
executed 5130 times by 2 tests: ds >> type.tz_isdst;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
174-
175 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
)
0-5130
176 ds >> type.tz_abbrind;
executed 5130 times by 2 tests: ds >> type.tz_abbrind;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
177-
178 type.tz_ttisgmt = false;-
179 type.tz_ttisstd = false;-
180 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-5130
181 types.resize(i);
never executed: types.resize(i);
0
182 }
executed 5130 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
183-
184 return
executed 908 times by 2 tests: return types;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
types;
executed 908 times by 2 tests: return types;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
908
185}-
186-
187static QMap<int, QByteArray> parseTzAbbreviations(QDataStream &ds, int tzh_charcnt, const QVector<QTzType> &types)-
188{-
189-
190-
191-
192-
193-
194 QMap<int, QByteArray> map;-
195 quint8 ch;-
196 QByteArray input;-
197-
198 for (int i = 0; i < tzh_charcnt
i < tzh_charcntDescription
TRUEevaluated 14643 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 14643 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-14643
199 ds >> ch;-
200 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 14643 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
)
0-14643
201 input.append(char(ch));
executed 14643 times by 2 tests: input.append(char(ch));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
14643
202 else-
203 return
never executed: return map;
map;
never executed: return map;
0
204 }-
205-
206 for (const QTzType &type : types) {-
207 QByteArray abbrev;-
208 for (int i = type.tz_abbrind; input.at(i) != '\0'
input.at(i) != '\0'Description
TRUEevaluated 17454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; ++i)
5130-17454
209 abbrev.append(input.at(i));
executed 17454 times by 2 tests: abbrev.append(input.at(i));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
17454
210-
211 map[type.tz_abbrind] = abbrev;-
212 }
executed 5130 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
213 return
executed 908 times by 2 tests: return map;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
map;
executed 908 times by 2 tests: return map;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
908
214}-
215-
216static void parseTzLeapSeconds(QDataStream &ds, int tzh_leapcnt, bool longTran)-
217{-
218-
219-
220 qint64 val;-
221 if (longTran
longTranDescription
TRUEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
454
222 qint64 time;-
223 for (int i = 0; i < tzh_leapcnt
i < tzh_leapcntDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0-454
224-
225 ds >> time;-
226-
227 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
228 ds >> val;
never executed: ds >> val;
0
229 }
never executed: end of block
0
230 }
executed 454 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
else {
454
231 for (int i = 0; i < tzh_leapcnt
i < tzh_leapcntDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0-454
232-
233 ds >> val;-
234-
235 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
236 ds >> val;
never executed: ds >> val;
0
237 }
never executed: end of block
0
238 }
executed 454 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
454
239}-
240-
241static QVector<QTzType> parseTzIndicators(QDataStream &ds, const QVector<QTzType> &types, int tzh_ttisstdcnt, int tzh_ttisgmtcnt)-
242{-
243 QVector<QTzType> result = types;-
244 bool temp;-
245-
246-
247 for (int i = 0; i < tzh_ttisstdcnt
i < tzh_ttisstdcntDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-5130
248 ds >> temp;-
249 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
)
0-5130
250 result[i].tz_ttisstd = temp;
executed 5130 times by 2 tests: result[i].tz_ttisstd = temp;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
251 }
executed 5130 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
252-
253-
254 for (int i = 0; i < tzh_ttisgmtcnt
i < tzh_ttisgmtcntDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 908 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-5130
255 ds >> temp;-
256 if (ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5130 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
)
0-5130
257 result[i].tz_ttisgmt = temp;
executed 5130 times by 2 tests: result[i].tz_ttisgmt = temp;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
258 }
executed 5130 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5130
259-
260 return
executed 908 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
result;
executed 908 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
908
261}-
262-
263static QByteArray parseTzPosixRule(QDataStream &ds)-
264{-
265-
266 QByteArray rule;-
267-
268 quint8 ch;-
269 ds >> ch;-
270 if (ch != '\n'
ch != '\n'Description
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
|| ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
271 return
never executed: return rule;
rule;
never executed: return rule;
0
272 ds >> ch;-
273 while (ch != '\n'
ch != '\n'Description
TRUEevaluated 5987 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& ds.status() == QDataStream::Ok
ds.status() == QDataStream::OkDescription
TRUEevaluated 5987 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
) {
0-5987
274 rule.append((char)ch);-
275 ds >> ch;-
276 }
executed 5987 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5987
277-
278 return
executed 454 times by 2 tests: return rule;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
rule;
executed 454 times by 2 tests: return rule;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
454
279}-
280-
281static QDate calculateDowDate(int year, int month, int dayOfWeek, int week)-
282{-
283 QDate date(year, month, 1);-
284 int startDow = date.dayOfWeek();-
285 if (startDow <= dayOfWeek
startDow <= dayOfWeekDescription
TRUEevaluated 295 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 3471 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
295-3471
286 date = date.addDays(dayOfWeek - startDow - 7);
executed 295 times by 2 tests: date = date.addDays(dayOfWeek - startDow - 7);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
295
287 else-
288 date = date.addDays(dayOfWeek - startDow);
executed 3471 times by 2 tests: date = date.addDays(dayOfWeek - startDow);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3471
289 date = date.addDays(week * 7);-
290 while (date.month() != month
date.month() != monthDescription
TRUEevaluated 1243 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 3766 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
1243-3766
291 date = date.addDays(-7);
executed 1243 times by 2 tests: date = date.addDays(-7);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1243
292 return
executed 3766 times by 2 tests: return date;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
date;
executed 3766 times by 2 tests: return date;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3766
293}-
294-
295static QDate calculatePosixDate(const QByteArray &dateRule, int year)-
296{-
297-
298 if (dateRule.at(0) == 'M'
dateRule.at(0) == 'M'Description
TRUEevaluated 3766 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
24-3766
299-
300 QList<QByteArray> dateParts = dateRule.split('.');-
301 int month = dateParts.at(0).mid(1).toInt();-
302 int week = dateParts.at(1).toInt();-
303 int dow = dateParts.at(2).toInt();-
304 if (dow == 0
dow == 0Description
TRUEevaluated 3514 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 252 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
252-3514
305 ++
executed 3514 times by 2 tests: ++dow;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
dow;
executed 3514 times by 2 tests: ++dow;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3514
306 return
executed 3766 times by 2 tests: return calculateDowDate(year, month, dow, week);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
calculateDowDate(year, month, dow, week);
executed 3766 times by 2 tests: return calculateDowDate(year, month, dow, week);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3766
307 } else if (dateRule.at(0) == 'J'
dateRule.at(0) == 'J'Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-24
308-
309 int doy = dateRule.mid(1).toInt();-
310 QDate date = QDate(year, 1, 1).addDays(doy - 1);-
311 if (QDate::isLeapYear(date.year())
QDate::isLeapYear(date.year())Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-24
312 date = date.addDays(-1);
never executed: date = date.addDays(-1);
0
313 return
executed 24 times by 1 test: return date;
Executed by:
  • tst_QTimeZone
date;
executed 24 times by 1 test: return date;
Executed by:
  • tst_QTimeZone
24
314 } else {-
315-
316 int doy = dateRule.toInt();-
317 return
never executed: return QDate(year, 1, 1).addDays(doy - 1);
QDate(year, 1, 1).addDays(doy - 1);
never executed: return QDate(year, 1, 1).addDays(doy - 1);
0
318 }-
319}-
320-
321-
322static int parsePosixTime(const char *begin, const char *end)-
323{-
324-
325 int hour, min = 0, sec = 0;-
326-
327-
328-
329-
330-
331-
332-
333 bool ok = false;-
334 hour = qstrtoll(begin, &begin, 10, &ok);-
335 if (!ok
!okDescription
TRUEnever evaluated
FALSEevaluated 5037 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
|| hour < 0
hour < 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 5029 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-5037
336 return
executed 8 times by 1 test: return (-2147483647 - 1);
Executed by:
  • tst_QTimeZone
(-2147483647 - 1);
executed 8 times by 1 test: return (-2147483647 - 1);
Executed by:
  • tst_QTimeZone
8
337 if (begin < end
begin < endDescription
TRUEevaluated 174 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 4855 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& *
*begin == ':'Description
TRUEevaluated 174 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
begin == ':'
*begin == ':'Description
TRUEevaluated 174 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-4855
338-
339 ++begin;-
340 min = qstrtoll(begin, &begin, 10, &ok);-
341 if (!ok
!okDescription
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • tst_QTimeZone
|| min < 0
min < 0Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-174
342 return
never executed: return (-2147483647 - 1);
(-2147483647 - 1);
never executed: return (-2147483647 - 1);
0
343-
344 if (begin < end
begin < endDescription
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& *
*begin == ':'Description
TRUEnever evaluated
FALSEnever evaluated
begin == ':'
*begin == ':'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-174
345-
346 ++begin;-
347 sec = qstrtoll(begin, &begin, 10, &ok);-
348 if (!ok
!okDescription
TRUEnever evaluated
FALSEnever evaluated
|| sec < 0
sec < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
349 return
never executed: return (-2147483647 - 1);
(-2147483647 - 1);
never executed: return (-2147483647 - 1);
0
350 }
never executed: end of block
0
351 }
executed 174 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
174
352-
353-
354 if (begin != end
begin != endDescription
TRUEnever evaluated
FALSEevaluated 5029 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-5029
355 return
never executed: return (-2147483647 - 1);
(-2147483647 - 1);
never executed: return (-2147483647 - 1);
0
356-
357 return
executed 5029 times by 2 tests: return (hour * 60 + min) * 60 + sec;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
(hour * 60 + min) * 60 + sec;
executed 5029 times by 2 tests: return (hour * 60 + min) * 60 + sec;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5029
358}-
359-
360static QTime parsePosixTransitionTime(const QByteArray &timeRule)-
361{-
362-
363 int value = parsePosixTime(timeRule.constBegin(), timeRule.constEnd());-
364 if (value == (-2147483647 - 1)
value == (-2147483647 - 1)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 504 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
8-504
365-
366 return
executed 8 times by 1 test: return QTime(2, 0, 0);
Executed by:
  • tst_QTimeZone
QTime(2, 0, 0);
executed 8 times by 1 test: return QTime(2, 0, 0);
Executed by:
  • tst_QTimeZone
8
367 }-
368 return
executed 504 times by 2 tests: return QTime::fromMSecsSinceStartOfDay(value * 1000);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
QTime::fromMSecsSinceStartOfDay(value * 1000);
executed 504 times by 2 tests: return QTime::fromMSecsSinceStartOfDay(value * 1000);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
504
369}-
370-
371static int parsePosixOffset(const char *begin, const char *end)-
372{-
373-
374-
375 bool negate = true;-
376 if (*
*begin == '+'Description
TRUEnever evaluated
FALSEevaluated 4525 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
begin == '+'
*begin == '+'Description
TRUEnever evaluated
FALSEevaluated 4525 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-4525
377 ++begin;-
378 }
never executed: end of block
else if (*
*begin == '-'Description
TRUEevaluated 2621 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1904 times by 1 test
Evaluated by:
  • tst_QTimeZone
begin == '-'
*begin == '-'Description
TRUEevaluated 2621 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1904 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
0-2621
379 negate = false;-
380 ++begin;-
381 }
executed 2621 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
2621
382-
383 int value = parsePosixTime(begin, end);-
384 if (value == (-2147483647 - 1)
value == (-2147483647 - 1)Description
TRUEnever evaluated
FALSEevaluated 4525 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-4525
385 return
never executed: return value;
value;
never executed: return value;
0
386 return
executed 4525 times by 2 tests: return negate ? -value : value;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
negate ? -value : value;
executed 4525 times by 2 tests: return negate ? -value : value;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
4525
387}-
388-
389static inline bool asciiIsLetter(char ch)-
390{-
391 ch |= 0x20;-
392 return
executed 20587 times by 2 tests: return ch >= 'a' && ch <= 'z';
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
ch >= 'a' && ch <= 'z';
executed 20587 times by 2 tests: return ch >= 'a' && ch <= 'z';
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
20587
393}-
394-
395-
396-
397-
398static QPair<QString, int> parsePosixZoneNameAndOffset(const char *&pos, const char *end)-
399{-
400 static const char offsetChars[] = "0123456789:";-
401 QPair<QString, int> result = qMakePair(QString(), (-2147483647 - 1));-
402-
403 const char *nameBegin = pos;-
404 const char *nameEnd;-
405 ((!(pos < end)) ? qt_assert("pos < end",__FILE__,465) : qt_noop());-
406-
407 if (*
*pos == '<'Description
TRUEevaluated 147 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 5002 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
pos == '<'
*pos == '<'Description
TRUEevaluated 147 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 5002 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
147-5002
408 nameBegin = pos + 1;-
409 nameEnd = nameBegin;-
410 while (nameEnd < end
nameEnd < endDescription
TRUEevaluated 588 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
&& *
*nameEnd != '>'Description
TRUEevaluated 441 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 147 times by 1 test
Evaluated by:
  • tst_QTimeZone
nameEnd != '>'
*nameEnd != '>'Description
TRUEevaluated 441 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 147 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
0-588
411-
412 ++nameEnd;-
413 }
executed 441 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
441
414 pos = nameEnd + 1;-
415 }
executed 147 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
else {
147
416 nameBegin = pos;-
417 nameEnd = nameBegin;-
418 while (nameEnd < end
nameEnd < endDescription
TRUEevaluated 20587 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 624 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& asciiIsLetter(*nameEnd)
asciiIsLetter(*nameEnd)Description
TRUEevaluated 16209 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 4378 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
624-20587
419 ++
executed 16209 times by 2 tests: ++nameEnd;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
nameEnd;
executed 16209 times by 2 tests: ++nameEnd;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
16209
420 pos = nameEnd;-
421 }
executed 5002 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5002
422 if (nameEnd - nameBegin < 3
nameEnd - nameBegin < 3Description
TRUEnever evaluated
FALSEevaluated 5149 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-5149
423 return
never executed: return result;
result;
never executed: return result;
0
424-
425-
426 const char *zoneBegin = pos;-
427 const char *zoneEnd = pos;-
428 if (zoneEnd < end
zoneEnd < endDescription
TRUEevaluated 4525 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 624 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& (zoneEnd[0] == '+'
zoneEnd[0] == '+'Description
TRUEnever evaluated
FALSEevaluated 4525 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
|| zoneEnd[0] == '-'
zoneEnd[0] == '-'Description
TRUEevaluated 2621 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1904 times by 1 test
Evaluated by:
  • tst_QTimeZone
))
0-4525
429 ++
executed 2621 times by 2 tests: ++zoneEnd;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
zoneEnd;
executed 2621 times by 2 tests: ++zoneEnd;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
2621
430 while (zoneEnd < end
zoneEnd < endDescription
TRUEevaluated 6295 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 4517 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
4517-6295
431 if (strchr(offsetChars, char(*zoneEnd)) == __null
strchr(offsetC...nd)) == __nullDescription
TRUEevaluated 632 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 5663 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
632-5663
432 break;
executed 632 times by 2 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
632
433 ++zoneEnd;-
434 }
executed 5663 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5663
435-
436 result.first = QString::fromUtf8(nameBegin, nameEnd - nameBegin);-
437 if (zoneEnd > zoneBegin
zoneEnd > zoneBeginDescription
TRUEevaluated 4525 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 624 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
624-4525
438 result.second = parsePosixOffset(zoneBegin, zoneEnd);
executed 4525 times by 2 tests: result.second = parsePosixOffset(zoneBegin, zoneEnd);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
4525
439 pos = zoneEnd;-
440 return
executed 5149 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
result;
executed 5149 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5149
441}-
442-
443static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray &posixRule,-
444 int startYear, int endYear,-
445 int lastTranMSecs)-
446{-
447 QVector<QTimeZonePrivate::Data> result;-
448-
449-
450 if (startYear > 292278994
startYear > 292278994Description
TRUEnever evaluated
FALSEevaluated 4517 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-4517
451 startYear = 292278994;
never executed: startYear = 292278994;
0
452 if (endYear > 292278994
endYear > 292278994Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 4516 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
1-4516
453 endYear = 292278994;
executed 1 time by 1 test: endYear = 292278994;
Executed by:
  • tst_QDateTime
1
454-
455-
456-
457-
458 QList<QByteArray> parts = posixRule.split(',');-
459-
460 QPair<QString, int> stdZone, dstZone;-
461 {-
462 const QByteArray &zoneinfo = parts.at(0);-
463 const char *begin = zoneinfo.constBegin();-
464-
465 stdZone = parsePosixZoneNameAndOffset(begin, zoneinfo.constEnd());-
466 if (stdZone.second == (-2147483647 - 1)
stdZone.second...147483647 - 1)Description
TRUEnever evaluated
FALSEevaluated 4517 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-4517
467 stdZone.second = 0;-
468 }
never executed: end of block
else if (begin < zoneinfo.constEnd()
begin < zoneinfo.constEnd()Description
TRUEevaluated 632 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 3885 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-3885
469 dstZone = parsePosixZoneNameAndOffset(begin, zoneinfo.constEnd());-
470 if (dstZone.second == (-2147483647 - 1)
dstZone.second...147483647 - 1)Description
TRUEevaluated 624 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
8-624
471-
472 dstZone.second = stdZone.second + (60 * 60);-
473 }
executed 624 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
624
474 }
executed 632 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
632
475 }-
476-
477-
478 if (parts.count() == 1
parts.count() == 1Description
TRUEevaluated 3885 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 632 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
632-3885
479 QTimeZonePrivate::Data data;-
480 data.atMSecsSinceEpoch = lastTranMSecs;-
481 data.offsetFromUtc = stdZone.second;-
482 data.standardTimeOffset = stdZone.second;-
483 data.daylightTimeOffset = 0;-
484 data.abbreviation = stdZone.first;-
485 result << data;-
486 return
executed 3885 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
result;
executed 3885 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3885
487 }-
488-
489-
490-
491 QList<QByteArray> dstParts = parts.at(1).split('/');-
492 QByteArray dstDateRule = dstParts.at(0);-
493 QTime dstTime;-
494 if (dstParts.count() > 1
dstParts.count() > 1Description
TRUEevaluated 172 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 460 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
172-460
495 dstTime = parsePosixTransitionTime(dstParts.at(1));
executed 172 times by 1 test: dstTime = parsePosixTransitionTime(dstParts.at(1));
Executed by:
  • tst_QTimeZone
172
496 else-
497 dstTime = QTime(2, 0, 0);
executed 460 times by 2 tests: dstTime = QTime(2, 0, 0);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
460
498-
499-
500 QList<QByteArray> stdParts = parts.at(2).split('/');-
501 QByteArray stdDateRule = stdParts.at(0);-
502 QTime stdTime;-
503 if (stdParts.count() > 1
stdParts.count() > 1Description
TRUEevaluated 340 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 292 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
292-340
504 stdTime = parsePosixTransitionTime(stdParts.at(1));
executed 340 times by 2 tests: stdTime = parsePosixTransitionTime(stdParts.at(1));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
340
505 else-
506 stdTime = QTime(2, 0, 0);
executed 292 times by 1 test: stdTime = QTime(2, 0, 0);
Executed by:
  • tst_QTimeZone
292
507-
508 for (int year = startYear; year <= endYear
year <= endYearDescription
TRUEevaluated 1895 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 632 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; ++year) {
632-1895
509 QTimeZonePrivate::Data dstData;-
510 QDateTime dst(calculatePosixDate(dstDateRule, year), dstTime, Qt::UTC);-
511 dstData.atMSecsSinceEpoch = dst.toMSecsSinceEpoch() - (stdZone.second * 1000);-
512 dstData.offsetFromUtc = dstZone.second;-
513 dstData.standardTimeOffset = stdZone.second;-
514 dstData.daylightTimeOffset = dstZone.second - stdZone.second;-
515 dstData.abbreviation = dstZone.first;-
516 QTimeZonePrivate::Data stdData;-
517 QDateTime std(calculatePosixDate(stdDateRule, year), stdTime, Qt::UTC);-
518 stdData.atMSecsSinceEpoch = std.toMSecsSinceEpoch() - (dstZone.second * 1000);-
519 stdData.offsetFromUtc = stdZone.second;-
520 stdData.standardTimeOffset = stdZone.second;-
521 stdData.daylightTimeOffset = 0;-
522 stdData.abbreviation = stdZone.first;-
523-
524 if (year == 292278994
year == 292278994Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 1894 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
&& (dstData.atMSecsSinceEpoch < 0
dstData.atMSecsSinceEpoch < 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
|| stdData.atMSecsSinceEpoch < 0
stdData.atMSecsSinceEpoch < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
FALSEnever evaluated
)) {
0-1894
525 if (dstData.atMSecsSinceEpoch > 0
dstData.atMSecsSinceEpoch > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
FALSEnever evaluated
) {
0-1
526 result << dstData;-
527 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QDateTime
else if (stdData.atMSecsSinceEpoch > 0
stdData.atMSecsSinceEpoch > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-1
528 result << stdData;-
529 }
never executed: end of block
0
530 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QDateTime
else if (dst < std
dst < stdDescription
TRUEevaluated 1654 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 240 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
1-1654
531 result << dstData << stdData;-
532 }
executed 1654 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
else {
1654
533 result << stdData << dstData;-
534 }
executed 240 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
240
535 }-
536 return
executed 632 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
result;
executed 632 times by 2 tests: return result;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
632
537}-
538-
539-
540QTzTimeZonePrivate::QTzTimeZonePrivate()-
541-
542 : m_icu(0)-
543-
544{-
545 init(systemTimeZoneId());-
546}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
2
547-
548-
549QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)-
550-
551 : m_icu(0)-
552-
553{-
554 init(ianaId);-
555}
executed 455 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
455
556-
557QTzTimeZonePrivate::QTzTimeZonePrivate(const QTzTimeZonePrivate &other)-
558 : QTimeZonePrivate(other), m_tranTimes(other.m_tranTimes),-
559 m_tranRules(other.m_tranRules), m_abbreviations(other.m_abbreviations),-
560-
561 m_icu(other.m_icu),-
562-
563 m_posixRule(other.m_posixRule)-
564{-
565}
executed 20 times by 1 test: end of block
Executed by:
  • tst_QDateTime
20
566-
567QTzTimeZonePrivate::~QTzTimeZonePrivate()-
568{-
569}-
570-
571QTimeZonePrivate *QTzTimeZonePrivate::clone()-
572{-
573 return
executed 20 times by 1 test: return new QTzTimeZonePrivate(*this);
Executed by:
  • tst_QDateTime
new QTzTimeZonePrivate(*this);
executed 20 times by 1 test: return new QTzTimeZonePrivate(*this);
Executed by:
  • tst_QDateTime
20
574}-
575-
576void QTzTimeZonePrivate::init(const QByteArray &ianaId)-
577{-
578 QFile tzif;-
579 if (ianaId.isEmpty()
ianaId.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 457 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-457
580-
581 tzif.setFileName(([]() -> QString { enum { Size = sizeof(u"" "/etc/localtime")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/etc/localtime" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
0
582 if (!tzif.open(QIODevice::ReadOnly)
!tzif.open(QIO...ice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
583 return;
never executed: return;
0
584 }
never executed: end of block
else {
0
585-
586 tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));-
587 if (!tzif.open(QIODevice::ReadOnly)
!tzif.open(QIO...ice::ReadOnly)Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
3-454
588 tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));-
589 if (!tzif.open(QIODevice::ReadOnly)
!tzif.open(QIO...ice::ReadOnly)Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
)
0-3
590 return;
executed 3 times by 2 tests: return;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3
591 }
never executed: end of block
0
592 }
executed 454 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
454
593-
594 QDataStream ds(&tzif);-
595-
596-
597 bool ok = false;-
598 QTzHeader hdr = parseTzHeader(ds, &ok);-
599 if (!ok
!okDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
|| ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
600 return;
never executed: return;
0
601 QVector<QTzTransition> tranList = parseTzTransitions(ds, hdr.tzh_timecnt, false);-
602 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
603 return;
never executed: return;
0
604 QVector<QTzType> typeList = parseTzTypes(ds, hdr.tzh_typecnt);-
605 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
606 return;
never executed: return;
0
607 QMap<int, QByteArray> abbrevMap = parseTzAbbreviations(ds, hdr.tzh_charcnt, typeList);-
608 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
609 return;
never executed: return;
0
610 parseTzLeapSeconds(ds, hdr.tzh_leapcnt, false);-
611 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
612 return;
never executed: return;
0
613 typeList = parseTzIndicators(ds, typeList, hdr.tzh_ttisstdcnt, hdr.tzh_ttisgmtcnt);-
614 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
615 return;
never executed: return;
0
616-
617-
618 if (hdr.tzh_version == '2'
hdr.tzh_version == '2'Description
TRUEevaluated 447 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QTimeZone
|| hdr.tzh_version == '3'
hdr.tzh_version == '3'Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-447
619 ok = false;-
620 QTzHeader hdr2 = parseTzHeader(ds, &ok);-
621 if (!ok
!okDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
|| ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
622 return;
never executed: return;
0
623 tranList = parseTzTransitions(ds, hdr2.tzh_timecnt, true);-
624 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
625 return;
never executed: return;
0
626 typeList = parseTzTypes(ds, hdr2.tzh_typecnt);-
627 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
628 return;
never executed: return;
0
629 abbrevMap = parseTzAbbreviations(ds, hdr2.tzh_charcnt, typeList);-
630 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
631 return;
never executed: return;
0
632 parseTzLeapSeconds(ds, hdr2.tzh_leapcnt, true);-
633 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
634 return;
never executed: return;
0
635 typeList = parseTzIndicators(ds, typeList, hdr2.tzh_ttisstdcnt, hdr2.tzh_ttisgmtcnt);-
636 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
637 return;
never executed: return;
0
638 m_posixRule = parseTzPosixRule(ds);-
639 if (ds.status() != QDataStream::Ok
ds.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
640 return;
never executed: return;
0
641 }
executed 454 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
454
642-
643-
644-
645-
646 const int size = abbrevMap.size();-
647 m_abbreviations.clear();-
648 m_abbreviations.reserve(size);-
649 QVector<int> abbrindList;-
650 abbrindList.reserve(size);-
651 for (auto it = abbrevMap.cbegin(), end = abbrevMap.cend(); it != end
it != endDescription
TRUEevaluated 1827 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; ++it) {
454-1827
652 m_abbreviations.append(it.value());-
653 abbrindList.append(it.key());-
654 }
executed 1827 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1827
655 for (int i = 0; i < typeList.size()
i < typeList.size()Description
TRUEevaluated 2700 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; ++i)
454-2700
656 typeList[i].tz_abbrind = abbrindList.indexOf(typeList.at(i).tz_abbrind);
executed 2700 times by 2 tests: typeList[i].tz_abbrind = abbrindList.indexOf(typeList.at(i).tz_abbrind);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
2700
657-
658-
659-
660 int utcOffset = 0;-
661 for (const QTzTransition &tran : qAsConst(tranList)) {-
662 if (!typeList.at(tran.tz_typeind).tz_isdst
!typeList.at(t...eind).tz_isdstDescription
TRUEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
3-454
663 utcOffset = typeList.at(tran.tz_typeind).tz_gmtoff;-
664 break;
executed 454 times by 2 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
454
665 }-
666 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
3
667-
668-
669 m_tranTimes.reserve(tranList.count());-
670 for (const QTzTransition &tz_tran : qAsConst(tranList)) {-
671 QTzTransitionTime tran;-
672 QTzTransitionRule rule;-
673 const QTzType tz_type = typeList.at(tz_tran.tz_typeind);-
674-
675-
676 if (!tz_type.tz_isdst
!tz_type.tz_isdstDescription
TRUEevaluated 16244 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 15309 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
15309-16244
677 utcOffset = tz_type.tz_gmtoff;
executed 16244 times by 2 tests: utcOffset = tz_type.tz_gmtoff;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
16244
678 rule.stdOffset = utcOffset;-
679 rule.dstOffset = tz_type.tz_gmtoff - utcOffset;-
680 rule.abbreviationIndex = tz_type.tz_abbrind;-
681-
682 int ruleIndex = m_tranRules.indexOf(rule);-
683 if (ruleIndex == -1
ruleIndex == -1Description
TRUEevaluated 1704 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 29849 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
1704-29849
684 m_tranRules.append(rule);-
685 tran.ruleIndex = m_tranRules.size() - 1;-
686 }
executed 1704 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
else {
1704
687 tran.ruleIndex = ruleIndex;-
688 }
executed 29849 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
29849
689-
690-
691 if (tz_type.tz_ttisgmt
tz_type.tz_ttisgmtDescription
TRUEevaluated 8759 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 22794 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
8759-22794
692 tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
executed 8759 times by 2 tests: tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
8759
693 else if (tz_type.tz_ttisstd
tz_type.tz_ttisstdDescription
TRUEevaluated 7286 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 15508 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
7286-15508
694 tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
executed 7286 times by 2 tests: tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7286
695 else-
696 tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
executed 15508 times by 2 tests: tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
15508
697-
698 m_tranTimes.append(tran);-
699 }
executed 31553 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
31553
700-
701 if (ianaId.isEmpty()
ianaId.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-454
702 m_id = systemTimeZoneId();
never executed: m_id = systemTimeZoneId();
0
703 else-
704 m_id = ianaId;
executed 454 times by 2 tests: m_id = ianaId;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
454
705}-
706-
707QLocale::Country QTzTimeZonePrivate::country() const-
708{-
709 return
executed 422 times by 1 test: return tzZones->value(m_id).country;
Executed by:
  • tst_QTimeZone
tzZones->value(m_id).country;
executed 422 times by 1 test: return tzZones->value(m_id).country;
Executed by:
  • tst_QTimeZone
422
710}-
711-
712QString QTzTimeZonePrivate::comment() const-
713{-
714 return
executed 421 times by 1 test: return QString::fromUtf8(tzZones->value(m_id).comment);
Executed by:
  • tst_QTimeZone
QString::fromUtf8(tzZones->value(m_id).comment);
executed 421 times by 1 test: return QString::fromUtf8(tzZones->value(m_id).comment);
Executed by:
  • tst_QTimeZone
421
715}-
716-
717QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,-
718 QTimeZone::NameType nameType,-
719 const QLocale &locale) const-
720{-
721-
722 if (!m_icu
!m_icuDescription
TRUEevaluated 421 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
)
0-421
723 m_icu = new QIcuTimeZonePrivate(m_id);
executed 421 times by 1 test: m_icu = new QIcuTimeZonePrivate(m_id);
Executed by:
  • tst_QTimeZone
421
724-
725-
726 if (m_icu->isValid()
m_icu->isValid()Description
TRUEevaluated 411 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
10-411
727 return
executed 411 times by 1 test: return m_icu->displayName(atMSecsSinceEpoch, nameType, locale);
Executed by:
  • tst_QTimeZone
m_icu->displayName(atMSecsSinceEpoch, nameType, locale);
executed 411 times by 1 test: return m_icu->displayName(atMSecsSinceEpoch, nameType, locale);
Executed by:
  • tst_QTimeZone
411
728-
729-
730-
731-
732 return
executed 10 times by 1 test: return abbreviation(atMSecsSinceEpoch);
Executed by:
  • tst_QTimeZone
abbreviation(atMSecsSinceEpoch);
executed 10 times by 1 test: return abbreviation(atMSecsSinceEpoch);
Executed by:
  • tst_QTimeZone
10
733}-
734-
735QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,-
736 QTimeZone::NameType nameType,-
737 const QLocale &locale) const-
738{-
739-
740 if (!m_icu
!m_icuDescription
TRUEnever evaluated
FALSEevaluated 842 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-842
741 m_icu = new QIcuTimeZonePrivate(m_id);
never executed: m_icu = new QIcuTimeZonePrivate(m_id);
0
742-
743-
744 if (m_icu->isValid()
m_icu->isValid()Description
TRUEevaluated 822 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
20-822
745 return
executed 822 times by 1 test: return m_icu->displayName(timeType, nameType, locale);
Executed by:
  • tst_QTimeZone
m_icu->displayName(timeType, nameType, locale);
executed 822 times by 1 test: return m_icu->displayName(timeType, nameType, locale);
Executed by:
  • tst_QTimeZone
822
746-
747-
748-
749-
750-
751-
752-
753 if (timeType == QTimeZone::GenericTime
timeType == QT...e::GenericTimeDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-20
754 timeType = QTimeZone::StandardTime;
never executed: timeType = QTimeZone::StandardTime;
0
755-
756-
757 const qint64 currentMSecs = QDateTime::currentMSecsSinceEpoch();-
758 QTimeZonePrivate::Data tran = data(currentMSecs);-
759 if (tran.atMSecsSinceEpoch != invalidMSecs()
tran.atMSecsSi...invalidMSecs()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
0-20
760 && ((timeType == QTimeZone::DaylightTime
timeType == QT...::DaylightTimeDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& tran.daylightTimeOffset != 0
tran.daylightTimeOffset != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-10
761 || (timeType == QTimeZone::StandardTime
timeType == QT...::StandardTimeDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& tran.daylightTimeOffset == 0
tran.daylightTimeOffset == 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
))) {
1-10
762 return
executed 10 times by 1 test: return tran.abbreviation;
Executed by:
  • tst_QTimeZone
tran.abbreviation;
executed 10 times by 1 test: return tran.abbreviation;
Executed by:
  • tst_QTimeZone
10
763 }-
764-
765-
766 tran = nextTransition(currentMSecs);-
767 if (tran.atMSecsSinceEpoch != invalidMSecs()
tran.atMSecsSi...invalidMSecs()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
1-9
768 && ((timeType == QTimeZone::DaylightTime
timeType == QT...::DaylightTimeDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
&& tran.daylightTimeOffset != 0
tran.daylightTimeOffset != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0-1
769 || (timeType == QTimeZone::StandardTime
timeType == QT...::StandardTimeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
&& tran.daylightTimeOffset == 0
tran.daylightTimeOffset == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
))) {
0-1
770 return
executed 1 time by 1 test: return tran.abbreviation;
Executed by:
  • tst_QTimeZone
tran.abbreviation;
executed 1 time by 1 test: return tran.abbreviation;
Executed by:
  • tst_QTimeZone
1
771 }-
772-
773-
774 tran = previousTransition(currentMSecs);-
775 if (tran.atMSecsSinceEpoch != invalidMSecs()
tran.atMSecsSi...invalidMSecs()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
)
0-9
776 tran = previousTransition(tran.atMSecsSinceEpoch);
executed 9 times by 1 test: tran = previousTransition(tran.atMSecsSinceEpoch);
Executed by:
  • tst_QTimeZone
9
777 if (tran.atMSecsSinceEpoch != invalidMSecs()
tran.atMSecsSi...invalidMSecs()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
0-9
778 && ((timeType == QTimeZone::DaylightTime
timeType == QT...::DaylightTimeDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
&& tran.daylightTimeOffset != 0
tran.daylightTimeOffset != 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-9
779 || (timeType == QTimeZone::StandardTime
timeType == QT...::StandardTimeDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& tran.daylightTimeOffset == 0
tran.daylightTimeOffset == 0Description
TRUEnever evaluated
FALSEnever evaluated
))) {
0-9
780 return
never executed: return tran.abbreviation;
tran.abbreviation;
never executed: return tran.abbreviation;
0
781 }-
782-
783-
784 for (int i = m_tranTimes.size() - 1; i >= 0
i >= 0Description
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
; --i) {
1-41
785 if (m_tranTimes.at(i).atMSecsSinceEpoch <= currentMSecs
m_tranTimes.at...= currentMSecsDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-41
786 tran = dataForTzTransition(m_tranTimes.at(i));-
787 if ((timeType == QTimeZone::DaylightTime
timeType == QT...::DaylightTimeDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
&& tran.daylightTimeOffset != 0
tran.daylightTimeOffset != 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 33 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-41
788 || (timeType == QTimeZone::StandardTime
timeType == QT...::StandardTimeDescription
TRUEnever evaluated
FALSEevaluated 33 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& tran.daylightTimeOffset == 0
tran.daylightTimeOffset == 0Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0-33
789 return
executed 8 times by 1 test: return tran.abbreviation;
Executed by:
  • tst_QTimeZone
tran.abbreviation;
executed 8 times by 1 test: return tran.abbreviation;
Executed by:
  • tst_QTimeZone
8
790 }-
791 }
executed 33 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
33
792 }
executed 33 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
33
793-
794-
795 return
executed 1 time by 1 test: return data(currentMSecs).abbreviation;
Executed by:
  • tst_QTimeZone
data(currentMSecs).abbreviation;
executed 1 time by 1 test: return data(currentMSecs).abbreviation;
Executed by:
  • tst_QTimeZone
1
796}-
797-
798QString QTzTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const-
799{-
800 return
executed 860 times by 2 tests: return data(atMSecsSinceEpoch).abbreviation;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data(atMSecsSinceEpoch).abbreviation;
executed 860 times by 2 tests: return data(atMSecsSinceEpoch).abbreviation;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
860
801}-
802-
803int QTzTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const-
804{-
805 const QTimeZonePrivate::Data tran = data(atMSecsSinceEpoch);-
806 return
executed 441 times by 2 tests: return tran.standardTimeOffset + tran.daylightTimeOffset;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
tran.standardTimeOffset + tran.daylightTimeOffset;
executed 441 times by 2 tests: return tran.standardTimeOffset + tran.daylightTimeOffset;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
441
807}-
808-
809int QTzTimeZonePrivate::standardTimeOffset(qint64 atMSecsSinceEpoch) const-
810{-
811 return
executed 693 times by 2 tests: return data(atMSecsSinceEpoch).standardTimeOffset;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data(atMSecsSinceEpoch).standardTimeOffset;
executed 693 times by 2 tests: return data(atMSecsSinceEpoch).standardTimeOffset;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
693
812}-
813-
814int QTzTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const-
815{-
816 return
executed 588 times by 2 tests: return data(atMSecsSinceEpoch).daylightTimeOffset;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data(atMSecsSinceEpoch).daylightTimeOffset;
executed 588 times by 2 tests: return data(atMSecsSinceEpoch).daylightTimeOffset;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
588
817}-
818-
819bool QTzTimeZonePrivate::hasDaylightTime() const-
820{-
821-
822 for (const QTzTransitionRule &rule : m_tranRules) {-
823 if (rule.dstOffset != 0
rule.dstOffset != 0Description
TRUEevaluated 1519 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 3635 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
1519-3635
824 return
executed 1519 times by 2 tests: return true;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
true;
executed 1519 times by 2 tests: return true;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1519
825 }
executed 3635 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3635
826 return
executed 660 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 660 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
660
827}-
828-
829bool QTzTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const-
830{-
831 return
executed 295 times by 2 tests: return (daylightTimeOffset(atMSecsSinceEpoch) != 0);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
(daylightTimeOffset(atMSecsSinceEpoch) != 0);
executed 295 times by 2 tests: return (daylightTimeOffset(atMSecsSinceEpoch) != 0);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
295
832}-
833-
834QTimeZonePrivate::Data QTzTimeZonePrivate::dataForTzTransition(QTzTransitionTime tran) const-
835{-
836 QTimeZonePrivate::Data data;-
837 data.atMSecsSinceEpoch = tran.atMSecsSinceEpoch;-
838 QTzTransitionRule rule = m_tranRules.at(tran.ruleIndex);-
839 data.standardTimeOffset = rule.stdOffset;-
840 data.daylightTimeOffset = rule.dstOffset;-
841 data.offsetFromUtc = rule.stdOffset + rule.dstOffset;-
842 data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex));-
843 return
executed 9024 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data;
executed 9024 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
9024
844}-
845-
846QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const-
847{-
848-
849 if (m_tranTimes.size() > 0
m_tranTimes.size() > 0Description
TRUEevaluated 3297 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch
m_tranTimes.la...SecsSinceEpochDescription
TRUEevaluated 2042 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1255 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-3297
850 && !m_posixRule.isEmpty()
!m_posixRule.isEmpty()Description
TRUEevaluated 2042 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& forMSecsSinceEpoch >= 0
forMSecsSinceEpoch >= 0Description
TRUEevaluated 2042 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
) {
0-2042
851 const int year = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch, Qt::UTC).date().year();-
852 QVector<QTimeZonePrivate::Data> posixTrans =-
853 calculatePosixTransitions(m_posixRule, year - 1, year + 1,-
854 m_tranTimes.last().atMSecsSinceEpoch);-
855 for (int i = posixTrans.size() - 1; i >= 0
i >= 0Description
TRUEevaluated 2059 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; --i) {
0-2059
856 if (posixTrans.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch
posixTrans.at(...SecsSinceEpochDescription
TRUEevaluated 2042 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
17-2042
857 QTimeZonePrivate::Data data = posixTrans.at(i);-
858 data.atMSecsSinceEpoch = forMSecsSinceEpoch;-
859 return
executed 2042 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data;
executed 2042 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
2042
860 }-
861 }
executed 17 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
17
862 }
never executed: end of block
0
863-
864-
865 for (int i = m_tranTimes.size() - 1; i >= 0
i >= 0Description
TRUEevaluated 54031 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; --i) {
3-54031
866 if (m_tranTimes.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch
m_tranTimes.at...SecsSinceEpochDescription
TRUEevaluated 1252 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 52779 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
1252-52779
867 Data data = dataForTzTransition(m_tranTimes.at(i));-
868 data.atMSecsSinceEpoch = forMSecsSinceEpoch;-
869 return
executed 1252 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data;
executed 1252 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1252
870 }-
871 }
executed 52779 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
52779
872-
873-
874 if (m_tranTimes.size() > 0
m_tranTimes.size() > 0Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
) {
0-3
875 Data data = dataForTzTransition(m_tranTimes.at(0));-
876 data.atMSecsSinceEpoch = forMSecsSinceEpoch;-
877 return
executed 3 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data;
executed 3 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3
878 }-
879-
880-
881 return
never executed: return invalidData();
invalidData();
never executed: return invalidData();
0
882}-
883-
884bool QTzTimeZonePrivate::hasTransitions() const-
885{-
886 return
executed 5705 times by 2 tests: return true;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
true;
executed 5705 times by 2 tests: return true;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5705
887}-
888-
889QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const-
890{-
891-
892 if (m_tranTimes.size() > 0
m_tranTimes.size() > 0Description
TRUEevaluated 8488 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch
m_tranTimes.la...SecsSinceEpochDescription
TRUEevaluated 1138 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 7350 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-8488
893 && !m_posixRule.isEmpty()
!m_posixRule.isEmpty()Description
TRUEevaluated 1138 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& afterMSecsSinceEpoch >= 0
afterMSecsSinceEpoch >= 0Description
TRUEevaluated 1120 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
0-1138
894 const int year = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch, Qt::UTC).date().year();-
895 QVector<QTimeZonePrivate::Data> posixTrans =-
896 calculatePosixTransitions(m_posixRule, year - 1, year + 1,-
897 m_tranTimes.last().atMSecsSinceEpoch);-
898 for (int i = 0; i < posixTrans.size()
i < posixTrans.size()Description
TRUEevaluated 1905 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 807 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
807-1905
899 if (posixTrans.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch
posixTrans.at(...SecsSinceEpochDescription
TRUEevaluated 313 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1592 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
313-1592
900 return
executed 313 times by 2 tests: return posixTrans.at(i);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
posixTrans.at(i);
executed 313 times by 2 tests: return posixTrans.at(i);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
313
901 }
executed 1592 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1592
902 }
executed 807 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
807
903-
904-
905 for (int i = 0; i < m_tranTimes.size()
i < m_tranTimes.size()Description
TRUEevaluated 275638 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1042 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; ++i) {
1042-275638
906 if (m_tranTimes.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch
m_tranTimes.at...SecsSinceEpochDescription
TRUEevaluated 7133 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 268505 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
7133-268505
907 return
executed 7133 times by 2 tests: return dataForTzTransition(m_tranTimes.at(i));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
dataForTzTransition(m_tranTimes.at(i));
executed 7133 times by 2 tests: return dataForTzTransition(m_tranTimes.at(i));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7133
908 }-
909 }
executed 268505 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
268505
910-
911-
912 return
executed 1042 times by 2 tests: return invalidData();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
invalidData();
executed 1042 times by 2 tests: return invalidData();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1042
913}-
914-
915QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const-
916{-
917-
918 if (m_tranTimes.size() > 0
m_tranTimes.size() > 0Description
TRUEevaluated 2796 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch
m_tranTimes.la...SecsSinceEpochDescription
TRUEevaluated 1355 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1441 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
0-2796
919 && !m_posixRule.isEmpty()
!m_posixRule.isEmpty()Description
TRUEevaluated 1355 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& beforeMSecsSinceEpoch > 0
beforeMSecsSinceEpoch > 0Description
TRUEevaluated 1355 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
) {
0-1355
920 const int year = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch, Qt::UTC).date().year();-
921 QVector<QTimeZonePrivate::Data> posixTrans =-
922 calculatePosixTransitions(m_posixRule, year - 1, year + 1,-
923 m_tranTimes.last().atMSecsSinceEpoch);-
924 for (int i = posixTrans.size() - 1; i >= 0
i >= 0Description
TRUEevaluated 2450 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
; --i) {
0-2450
925 if (posixTrans.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch
posixTrans.at(...SecsSinceEpochDescription
TRUEevaluated 1355 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1095 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
1095-1355
926 return
executed 1355 times by 2 tests: return posixTrans.at(i);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
posixTrans.at(i);
executed 1355 times by 2 tests: return posixTrans.at(i);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1355
927 }
executed 1095 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1095
928 }
never executed: end of block
0
929-
930-
931 for (int i = m_tranTimes.size() - 1; i >= 0
i >= 0Description
TRUEevaluated 82123 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 846 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; --i) {
846-82123
932 if (m_tranTimes.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch
m_tranTimes.at...SecsSinceEpochDescription
TRUEevaluated 595 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 81528 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
595-81528
933 return
executed 595 times by 2 tests: return dataForTzTransition(m_tranTimes.at(i));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
dataForTzTransition(m_tranTimes.at(i));
executed 595 times by 2 tests: return dataForTzTransition(m_tranTimes.at(i));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
595
934 }-
935 }
executed 81528 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
81528
936-
937-
938 return
executed 846 times by 2 tests: return invalidData();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
invalidData();
executed 846 times by 2 tests: return invalidData();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
846
939}-
940-
941-
942QByteArray QTzTimeZonePrivate::systemTimeZoneId() const-
943{-
944-
945 QByteArray ianaId = qgetenv("TZ");-
946 if (!ianaId.isEmpty()
!ianaId.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& ianaId.at(0) == ':'
ianaId.at(0) == ':'Description
TRUEnever evaluated
FALSEnever evaluated
)
0-2
947 ianaId = ianaId.mid(1);
never executed: ianaId = ianaId.mid(1);
0
948-
949-
950-
951-
952-
953 if (ianaId == "/etc/localtime"
ianaId == "/etc/localtime"Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-2
954 ianaId.clear();
never executed: ianaId.clear();
0
955-
956-
957 if (ianaId.isEmpty()
ianaId.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-2
958 QFile tzif(([]() -> QString { enum { Size = sizeof(u"" "/etc/timezone")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/etc/timezone" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 2 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QTimeZone
qstring_literal_temp;
executed 2 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QTimeZone
}()));
2
959 if (tzif.open(QIODevice::ReadOnly)
tzif.open(QIODevice::ReadOnly)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-2
960-
961 QTextStream ts(&tzif);-
962 if (!ts.atEnd()
!ts.atEnd()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
)
0-2
963 ianaId = ts.readLine().toUtf8();
executed 2 times by 1 test: ianaId = ts.readLine().toUtf8();
Executed by:
  • tst_QTimeZone
2
964 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
2
965 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
2
966-
967-
968 if (ianaId.isEmpty()
ianaId.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
0-2
969 const QString path = QFile::symLinkTarget(([]() -> QString { enum { Size = sizeof(u"" "/etc/localtime")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/etc/localtime" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
0
970 if (!path.isEmpty()
!path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
971-
972 int index = path.indexOf(QLatin1String("/zoneinfo/")) + 10;-
973 ianaId = path.mid(index).toUtf8();-
974 }
never executed: end of block
0
975 }
never executed: end of block
0
976-
977-
978-
979 if (ianaId.isEmpty()
ianaId.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
0-2
980 QFile tzif(([]() -> QString { enum { Size = sizeof(u"" "/etc/sysconfig/clock")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/etc/sysconfig/clock" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
0
981 if (tzif.open(QIODevice::ReadOnly)
tzif.open(QIODevice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
982-
983 QTextStream ts(&tzif);-
984 QString line;-
985 while (ianaId.isEmpty()
ianaId.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& !ts.atEnd()
!ts.atEnd()Description
TRUEnever evaluated
FALSEnever evaluated
&& ts.status() == QTextStream::Ok
ts.status() == QTextStream::OkDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
986 line = ts.readLine();-
987 if (line.startsWith(QLatin1String("ZONE="))
line.startsWit...ring("ZONE="))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
988 ianaId = line.mid(6, line.size() - 7).toUtf8();-
989 }
never executed: end of block
else if (line.startsWith(QLatin1String("TIMEZONE="))
line.startsWit...("TIMEZONE="))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
990 ianaId = line.mid(10, line.size() - 11).toUtf8();-
991 }
never executed: end of block
0
992 }
never executed: end of block
0
993 }
never executed: end of block
0
994 }
never executed: end of block
0
995-
996-
997 if (ianaId.isEmpty()
ianaId.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-2
998 ianaId = utcQByteArray();
never executed: ianaId = utcQByteArray();
0
999-
1000 return
executed 2 times by 1 test: return ianaId;
Executed by:
  • tst_QTimeZone
ianaId;
executed 2 times by 1 test: return ianaId;
Executed by:
  • tst_QTimeZone
2
1001}-
1002-
1003QList<QByteArray> QTzTimeZonePrivate::availableTimeZoneIds() const-
1004{-
1005 QList<QByteArray> result = tzZones->keys();-
1006 std::sort(result.begin(), result.end());-
1007 return
executed 468 times by 1 test: return result;
Executed by:
  • tst_QTimeZone
result;
executed 468 times by 1 test: return result;
Executed by:
  • tst_QTimeZone
468
1008}-
1009-
1010QList<QByteArray> QTzTimeZonePrivate::availableTimeZoneIds(QLocale::Country country) const-
1011{-
1012-
1013 QList<QByteArray> result;-
1014 for (auto it = tzZones->cbegin(), end = tzZones->cend(); it != end
it != endDescription
TRUEevaluated 421 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
; ++it) {
1-421
1015 if (it.value().country == country
it.value().country == countryDescription
TRUEevaluated 29 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 392 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
29-392
1016 result << it.key();
executed 29 times by 1 test: result << it.key();
Executed by:
  • tst_QTimeZone
29
1017 }
executed 421 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
421
1018 std::sort(result.begin(), result.end());-
1019 return
executed 1 time by 1 test: return result;
Executed by:
  • tst_QTimeZone
result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_QTimeZone
1
1020}-
1021-
1022-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9