OpenCoverage

qtimezoneprivate.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qtimezoneprivate.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7enum {-
8 MSECS_TRAN_WINDOW = 21600000-
9};-
10-
11-
12-
13-
14-
15static const int windowsDataTableSize = sizeof(windowsDataTable) / sizeof(QWindowsData) - 1;-
16static const int zoneDataTableSize = sizeof(zoneDataTable) / sizeof(QZoneData) - 1;-
17static const int utcDataTableSize = sizeof(utcDataTable) / sizeof(QUtcData) - 1;-
18-
19-
20static const QZoneData *zoneData(quint16 index)-
21{-
22 ((!(index < zoneDataTableSize)) ? qt_assert("index < zoneDataTableSize",__FILE__,67) : qt_noop());-
23 return
executed 6186 times by 1 test: return &zoneDataTable[index];
Executed by:
  • tst_QTimeZone
&zoneDataTable[index];
executed 6186 times by 1 test: return &zoneDataTable[index];
Executed by:
  • tst_QTimeZone
6186
24}-
25-
26static const QWindowsData *windowsData(quint16 index)-
27{-
28 ((!(index < windowsDataTableSize)) ? qt_assert("index < windowsDataTableSize",__FILE__,73) : qt_noop());-
29 return
executed 842 times by 1 test: return &windowsDataTable[index];
Executed by:
  • tst_QTimeZone
&windowsDataTable[index];
executed 842 times by 1 test: return &windowsDataTable[index];
Executed by:
  • tst_QTimeZone
842
30}-
31-
32static const QUtcData *utcData(quint16 index)-
33{-
34 ((!(index < utcDataTableSize)) ? qt_assert("index < utcDataTableSize",__FILE__,79) : qt_noop());-
35 return
executed 37617 times by 2 tests: return &utcDataTable[index];
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
&utcDataTable[index];
executed 37617 times by 2 tests: return &utcDataTable[index];
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
37617
36}-
37-
38-
39static QByteArray windowsId(const QWindowsData *windowsData)-
40{-
41 return
executed 554 times by 1 test: return (windowsIdData + windowsData->windowsIdIndex);
Executed by:
  • tst_QTimeZone
(windowsIdData + windowsData->windowsIdIndex);
executed 554 times by 1 test: return (windowsIdData + windowsData->windowsIdIndex);
Executed by:
  • tst_QTimeZone
554
42}-
43-
44-
45static QByteArray ianaId(const QWindowsData *windowsData)-
46{-
47 return
executed 1 time by 1 test: return (ianaIdData + windowsData->ianaIdIndex);
Executed by:
  • tst_QTimeZone
(ianaIdData + windowsData->ianaIdIndex);
executed 1 time by 1 test: return (ianaIdData + windowsData->ianaIdIndex);
Executed by:
  • tst_QTimeZone
1
48}-
49-
50-
51static QByteArray ianaId(const QZoneData *zoneData)-
52{-
53 return
executed 1692 times by 1 test: return (ianaIdData + zoneData->ianaIdIndex);
Executed by:
  • tst_QTimeZone
(ianaIdData + zoneData->ianaIdIndex);
executed 1692 times by 1 test: return (ianaIdData + zoneData->ianaIdIndex);
Executed by:
  • tst_QTimeZone
1692
54}-
55-
56static QByteArray utcId(const QUtcData *utcData)-
57{-
58 return
executed 37580 times by 2 tests: return (ianaIdData + utcData->ianaIdIndex);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
(ianaIdData + utcData->ianaIdIndex);
executed 37580 times by 2 tests: return (ianaIdData + utcData->ianaIdIndex);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
37580
59}-
60-
61static quint16 toWindowsIdKey(const QByteArray &winId)-
62{-
63 for (quint16 i = 0; i < windowsDataTableSize
i < windowsDataTableSizeDescription
TRUEevaluated 552 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
3-552
64 const QWindowsData *data = windowsData(i);-
65 if (windowsId(data) == winId
windowsId(data) == winIdDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 543 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
9-543
66 return
executed 9 times by 1 test: return data->windowsIdKey;
Executed by:
  • tst_QTimeZone
data->windowsIdKey;
executed 9 times by 1 test: return data->windowsIdKey;
Executed by:
  • tst_QTimeZone
9
67 }
executed 543 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
543
68 return
executed 3 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
0;
executed 3 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
3
69}-
70-
71static QByteArray toWindowsIdLiteral(quint16 windowsIdKey)-
72{-
73 for (quint16 i = 0; i < windowsDataTableSize
i < windowsDataTableSizeDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
; ++i) {
0-52
74 const QWindowsData *data = windowsData(i);-
75 if (data->windowsIdKey == windowsIdKey
data->windowsI...= windowsIdKeyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
2-50
76 return
executed 2 times by 1 test: return windowsId(data);
Executed by:
  • tst_QTimeZone
windowsId(data);
executed 2 times by 1 test: return windowsId(data);
Executed by:
  • tst_QTimeZone
2
77 }
executed 50 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
50
78 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
79}-
80-
81-
82-
83-
84-
85QTimeZonePrivate::QTimeZonePrivate()-
86{-
87}-
88-
89QTimeZonePrivate::QTimeZonePrivate(const QTimeZonePrivate &other)-
90 : QSharedData(other), m_id(other.m_id)-
91{-
92}
executed 20 times by 1 test: end of block
Executed by:
  • tst_QDateTime
20
93-
94QTimeZonePrivate::~QTimeZonePrivate()-
95{-
96}-
97-
98QTimeZonePrivate *QTimeZonePrivate::clone()-
99{-
100 return
never executed: return new QTimeZonePrivate(*this);
new QTimeZonePrivate(*this);
never executed: return new QTimeZonePrivate(*this);
0
101}-
102-
103bool QTimeZonePrivate::operator==(const QTimeZonePrivate &other) const-
104{-
105-
106-
107-
108 return
executed 21 times by 2 tests: return (m_id == other.m_id);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
(m_id == other.m_id);
executed 21 times by 2 tests: return (m_id == other.m_id);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
21
109}-
110-
111bool QTimeZonePrivate::operator!=(const QTimeZonePrivate &other) const-
112{-
113 return
executed 2 times by 1 test: return !(*this == other);
Executed by:
  • tst_QTimeZone
!(*this == other);
executed 2 times by 1 test: return !(*this == other);
Executed by:
  • tst_QTimeZone
2
114}-
115-
116bool QTimeZonePrivate::isValid() const-
117{-
118 return
executed 13410 times by 2 tests: return !m_id.isEmpty();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
!m_id.isEmpty();
executed 13410 times by 2 tests: return !m_id.isEmpty();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
13410
119}-
120-
121QByteArray QTimeZonePrivate::id() const-
122{-
123 return
executed 470 times by 2 tests: return m_id;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
m_id;
executed 470 times by 2 tests: return m_id;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
470
124}-
125-
126QLocale::Country QTimeZonePrivate::country() const-
127{-
128-
129 for (int i = 0; i < zoneDataTableSize
i < zoneDataTableSizeDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
130 const QZoneData *data = zoneData(i);-
131 if (ianaId(data).split(' ').contains(m_id)
ianaId(data).s...contains(m_id)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
132 return
never executed: return (QLocale::Country)data->country;
(QLocale::Country)data->country;
never executed: return (QLocale::Country)data->country;
0
133 }
never executed: end of block
0
134 return
never executed: return QLocale::AnyCountry;
QLocale::AnyCountry;
never executed: return QLocale::AnyCountry;
0
135}-
136-
137QString QTimeZonePrivate::comment() const-
138{-
139 return
never executed: return QString();
QString();
never executed: return QString();
0
140}-
141-
142QString QTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,-
143 QTimeZone::NameType nameType,-
144 const QLocale &locale) const-
145{-
146 if (nameType == QTimeZone::OffsetName
nameType == QT...ne::OffsetNameDescription
TRUEnever evaluated
FALSEevaluated 451 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-451
147 return
never executed: return isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch));
isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch));
never executed: return isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch));
0
148-
149 if (isDaylightTime(atMSecsSinceEpoch)
isDaylightTime...ecsSinceEpoch)Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 430 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
21-430
150 return
executed 21 times by 1 test: return displayName(QTimeZone::DaylightTime, nameType, locale);
Executed by:
  • tst_QTimeZone
displayName(QTimeZone::DaylightTime, nameType, locale);
executed 21 times by 1 test: return displayName(QTimeZone::DaylightTime, nameType, locale);
Executed by:
  • tst_QTimeZone
21
151 else-
152 return
executed 430 times by 1 test: return displayName(QTimeZone::StandardTime, nameType, locale);
Executed by:
  • tst_QTimeZone
displayName(QTimeZone::StandardTime, nameType, locale);
executed 430 times by 1 test: return displayName(QTimeZone::StandardTime, nameType, locale);
Executed by:
  • tst_QTimeZone
430
153}-
154-
155QString QTimeZonePrivate::displayName(QTimeZone::TimeType timeType,-
156 QTimeZone::NameType nameType,-
157 const QLocale &locale) const-
158{-
159 (void)timeType;-
160 (void)nameType;-
161 (void)locale;-
162 return
never executed: return QString();
QString();
never executed: return QString();
0
163}-
164-
165QString QTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const-
166{-
167 (void)atMSecsSinceEpoch;-
168 return
never executed: return QString();
QString();
never executed: return QString();
0
169}-
170-
171int QTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const-
172{-
173 return
executed 45 times by 1 test: return standardTimeOffset(atMSecsSinceEpoch) + daylightTimeOffset(atMSecsSinceEpoch);
Executed by:
  • tst_QTimeZone
standardTimeOffset(atMSecsSinceEpoch) + daylightTimeOffset(atMSecsSinceEpoch);
executed 45 times by 1 test: return standardTimeOffset(atMSecsSinceEpoch) + daylightTimeOffset(atMSecsSinceEpoch);
Executed by:
  • tst_QTimeZone
45
174}-
175-
176int QTimeZonePrivate::standardTimeOffset(qint64 atMSecsSinceEpoch) const-
177{-
178 (void)atMSecsSinceEpoch;-
179 return
never executed: return invalidSeconds();
invalidSeconds();
never executed: return invalidSeconds();
0
180}-
181-
182int QTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const-
183{-
184 (void)atMSecsSinceEpoch;-
185 return
never executed: return invalidSeconds();
invalidSeconds();
never executed: return invalidSeconds();
0
186}-
187-
188bool QTimeZonePrivate::hasDaylightTime() const-
189{-
190 return
executed 207 times by 2 tests: return false;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
false;
executed 207 times by 2 tests: return false;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
207
191}-
192-
193bool QTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const-
194{-
195 (void)atMSecsSinceEpoch;-
196 return
executed 41 times by 2 tests: return false;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
false;
executed 41 times by 2 tests: return false;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
41
197}-
198-
199QTimeZonePrivate::Data QTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const-
200{-
201 (void)forMSecsSinceEpoch;-
202 return
never executed: return invalidData();
invalidData();
never executed: return invalidData();
0
203}-
204-
205-
206-
207QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) const-
208{-
209 if (!hasDaylightTime()
!hasDaylightTime()Description
TRUEevaluated 347 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 646 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
||!hasTransitions()
!hasTransitions()Description
TRUEnever evaluated
FALSEevaluated 646 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-646
210-
211-
212 return
executed 347 times by 2 tests: return data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));
executed 347 times by 2 tests: return data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
347
213 }-
214-
215-
216-
217 Data tran = previousTransition(forLocalMSecs);-
218 Data nextTran;-
219-
220-
221-
222 if (forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)
forLocalMSecs ...romUtc * 1000)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 641 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
5-641
223 while (tran.atMSecsSinceEpoch != invalidMSecs()
tran.atMSecsSi...invalidMSecs()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEnever evaluated
0-10
224 && forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)
forLocalMSecs ...romUtc * 1000)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTime
) {
5
225 nextTran = tran;-
226 tran = previousTransition(tran.atMSecsSinceEpoch);-
227 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QDateTime
5
228 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QDateTime
else {
5
229-
230-
231 nextTran = nextTransition(tran.atMSecsSinceEpoch);-
232 while (nextTran.atMSecsSinceEpoch != invalidMSecs()
nextTran.atMSe...invalidMSecs()Description
TRUEevaluated 6111 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 249 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
249-6111
233 && forLocalMSecs >= nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)
forLocalMSecs ...romUtc * 1000)Description
TRUEevaluated 5719 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 392 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
392-5719
234 tran = nextTran;-
235 nextTran = nextTransition(tran.atMSecsSinceEpoch);-
236 }
executed 5719 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
5719
237 }
executed 641 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
641
238-
239 if (tran.daylightTimeOffset == 0
tran.daylightTimeOffset == 0Description
TRUEevaluated 587 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 59 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
59-587
240-
241-
242 qint64 diffPrevTran = forLocalMSecs-
243 - (tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000));-
244 qint64 diffNextTran = nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)-
245 - forLocalMSecs;-
246 if (diffPrevTran >= 0
diffPrevTran >= 0Description
TRUEevaluated 587 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& diffPrevTran < MSECS_TRAN_WINDOW
diffPrevTran <...CS_TRAN_WINDOWDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 572 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-587
247-
248-
249-
250-
251-
252 Data dstTran = previousTransition(tran.atMSecsSinceEpoch);-
253 if (dstTran.atMSecsSinceEpoch != invalidMSecs()
dstTran.atMSec...invalidMSecs()Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEnever evaluated
0-15
254 && dstTran.daylightTimeOffset > 0
dstTran.daylightTimeOffset > 0Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEnever evaluated
&& diffPrevTran < (dstTran.daylightTimeOffset * 1000)
diffPrevTran <...Offset * 1000)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTime
)
0-15
255 tran = dstTran;
executed 12 times by 1 test: tran = dstTran;
Executed by:
  • tst_QDateTime
12
256 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_QDateTime
else if (diffNextTran >= 0
diffNextTran >= 0Description
TRUEevaluated 572 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEnever evaluated
&& diffNextTran <= (nextTran.daylightTimeOffset * 1000)
diffNextTran <...Offset * 1000)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 570 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
0-572
257-
258-
259 tran = nextTran;-
260 forLocalMSecs = forLocalMSecs + (nextTran.daylightTimeOffset * 1000);-
261 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QDateTime
2
262 }
executed 587 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
587
263-
264-
265 tran.atMSecsSinceEpoch = forLocalMSecs - (tran.offsetFromUtc * 1000);-
266 return
executed 646 times by 2 tests: return tran;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
tran;
executed 646 times by 2 tests: return tran;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
646
267}-
268-
269bool QTimeZonePrivate::hasTransitions() const-
270{-
271 return
executed 481 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 481 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
481
272}-
273-
274QTimeZonePrivate::Data QTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const-
275{-
276 (void)afterMSecsSinceEpoch;-
277 return
never executed: return invalidData();
invalidData();
never executed: return invalidData();
0
278}-
279-
280QTimeZonePrivate::Data QTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const-
281{-
282 (void)beforeMSecsSinceEpoch;-
283 return
never executed: return invalidData();
invalidData();
never executed: return invalidData();
0
284}-
285-
286QTimeZonePrivate::DataList QTimeZonePrivate::transitions(qint64 fromMSecsSinceEpoch,-
287 qint64 toMSecsSinceEpoch) const-
288{-
289 DataList list;-
290 if (toMSecsSinceEpoch >= fromMSecsSinceEpoch
toMSecsSinceEp...SecsSinceEpochDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-2
291-
292 Data next = nextTransition(fromMSecsSinceEpoch - 1);-
293 while (next.atMSecsSinceEpoch != invalidMSecs()
next.atMSecsSi...invalidMSecs()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
0-6
294 && next.atMSecsSinceEpoch <= toMSecsSinceEpoch
next.atMSecsSi...SecsSinceEpochDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
2-4
295 list.append(next);-
296 next = nextTransition(next.atMSecsSinceEpoch);-
297 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
4
298 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
2
299 return
executed 2 times by 1 test: return list;
Executed by:
  • tst_QTimeZone
list;
executed 2 times by 1 test: return list;
Executed by:
  • tst_QTimeZone
2
300}-
301-
302QByteArray QTimeZonePrivate::systemTimeZoneId() const-
303{-
304 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
305}-
306-
307QList<QByteArray> QTimeZonePrivate::availableTimeZoneIds() const-
308{-
309 return
never executed: return QList<QByteArray>();
QList<QByteArray>();
never executed: return QList<QByteArray>();
0
310}-
311-
312QList<QByteArray> QTimeZonePrivate::availableTimeZoneIds(QLocale::Country country) const-
313{-
314-
315 QList<QByteArray> regions;-
316-
317-
318 for (int i = 0; i < zoneDataTableSize
i < zoneDataTableSizeDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
319 if (zoneData(i)->country == country
zoneData(i)->c...try == countryDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
320 regions += ianaId(zoneData(i)).split(' ');
never executed: regions += ianaId(zoneData(i)).split(' ');
0
321 }
never executed: end of block
0
322-
323 std::sort(regions.begin(), regions.end());-
324 regions.erase(std::unique(regions.begin(), regions.end()), regions.end());-
325-
326-
327 const QList<QByteArray> all = availableTimeZoneIds();-
328 QList<QByteArray> result;-
329 result.reserve(qMin(all.size(), regions.size()));-
330 std::set_intersection(all.begin(), all.end(), regions.cbegin(), regions.cend(),-
331 std::back_inserter(result));-
332 return
never executed: return result;
result;
never executed: return result;
0
333}-
334-
335QList<QByteArray> QTimeZonePrivate::availableTimeZoneIds(int offsetFromUtc) const-
336{-
337-
338 QList<QByteArray> offsets;-
339-
340 for (int i = 0; i < windowsDataTableSize
i < windowsDataTableSizeDescription
TRUEevaluated 106 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
1-106
341 const QWindowsData *winData = windowsData(i);-
342 if (winData->offsetFromUtc == offsetFromUtc
winData->offse... offsetFromUtcDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 102 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
4-102
343 for (int j = 0; j < zoneDataTableSize
j < zoneDataTableSizeDescription
TRUEevaluated 1376 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++j) {
4-1376
344 const QZoneData *data = zoneData(j);-
345 if (data->windowsIdKey == winData->windowsIdKey
data->windowsI...->windowsIdKeyDescription
TRUEevaluated 27 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1349 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
27-1349
346 offsets += ianaId(data).split(' ');
executed 27 times by 1 test: offsets += ianaId(data).split(' ');
Executed by:
  • tst_QTimeZone
27
347 }
executed 1376 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
1376
348 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
4
349 }
executed 106 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
106
350-
351 std::sort(offsets.begin(), offsets.end());-
352 offsets.erase(std::unique(offsets.begin(), offsets.end()), offsets.end());-
353-
354-
355 const QList<QByteArray> all = availableTimeZoneIds();-
356 QList<QByteArray> result;-
357 result.reserve(qMin(all.size(), offsets.size()));-
358 std::set_intersection(all.begin(), all.end(), offsets.cbegin(), offsets.cend(),-
359 std::back_inserter(result));-
360 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
361}-
362-
363-
364void QTimeZonePrivate::serialize(QDataStream &ds) const-
365{-
366 ds << QString::fromUtf8(m_id);-
367}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
2
368-
369-
370-
371-
372QTimeZonePrivate::Data QTimeZonePrivate::invalidData()-
373{-
374 Data data;-
375 data.atMSecsSinceEpoch = invalidMSecs();-
376 data.offsetFromUtc = invalidSeconds();-
377 data.standardTimeOffset = invalidSeconds();-
378 data.daylightTimeOffset = invalidSeconds();-
379 return
executed 1890 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
data;
executed 1890 times by 2 tests: return data;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
1890
380}-
381-
382QTimeZone::OffsetData QTimeZonePrivate::invalidOffsetData()-
383{-
384 QTimeZone::OffsetData offsetData;-
385 offsetData.atUtc = QDateTime();-
386 offsetData.offsetFromUtc = invalidSeconds();-
387 offsetData.standardTimeOffset = invalidSeconds();-
388 offsetData.daylightTimeOffset = invalidSeconds();-
389 return
executed 5080 times by 1 test: return offsetData;
Executed by:
  • tst_QTimeZone
offsetData;
executed 5080 times by 1 test: return offsetData;
Executed by:
  • tst_QTimeZone
5080
390}-
391-
392QTimeZone::OffsetData QTimeZonePrivate::toOffsetData(const QTimeZonePrivate::Data &data)-
393{-
394 QTimeZone::OffsetData offsetData = invalidOffsetData();-
395 if (data.atMSecsSinceEpoch != invalidMSecs()
data.atMSecsSi...invalidMSecs()Description
TRUEevaluated 3011 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1626 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
1626-3011
396 offsetData.atUtc = QDateTime::fromMSecsSinceEpoch(data.atMSecsSinceEpoch, Qt::UTC);-
397 offsetData.offsetFromUtc = data.offsetFromUtc;-
398 offsetData.standardTimeOffset = data.standardTimeOffset;-
399 offsetData.daylightTimeOffset = data.daylightTimeOffset;-
400 offsetData.abbreviation = data.abbreviation;-
401 }
executed 3011 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
3011
402 return
executed 4637 times by 1 test: return offsetData;
Executed by:
  • tst_QTimeZone
offsetData;
executed 4637 times by 1 test: return offsetData;
Executed by:
  • tst_QTimeZone
4637
403}-
404-
405-
406bool QTimeZonePrivate::isValidId(const QByteArray &ianaId)-
407{-
408 const int MinSectionLength = 1;-
409 const int MaxSectionLength = 14;-
410 int sectionLength = 0;-
411 for (const char *it = ianaId.begin(), * const end = ianaId.end(); it != end
it != endDescription
TRUEevaluated 7709 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 518 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++it, ++sectionLength) {
518-7709
412 const char ch = *it;-
413 if (ch == '/'
ch == '/'Description
TRUEevaluated 578 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 7131 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
578-7131
414 if (sectionLength < MinSectionLength
sectionLength ...nSectionLengthDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 575 times by 1 test
Evaluated by:
  • tst_QTimeZone
|| sectionLength > MaxSectionLength
sectionLength ...xSectionLengthDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 572 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
3-575
415 return
executed 6 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 6 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
6
416 sectionLength = -1;-
417 }
executed 572 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
else if (ch == '-'
ch == '-'Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 7101 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
30-7101
418 if (sectionLength == 0
sectionLength == 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
4-26
419 return
executed 4 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
4
420 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
else if (!(ch >= 'a'
ch >= 'a'Description
TRUEevaluated 5499 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1602 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& ch <= 'z'
ch <= 'z'Description
TRUEevaluated 5499 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
)
0-5499
421 && !(ch >= 'A'
ch >= 'A'Description
TRUEevaluated 1143 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 459 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& ch <= 'Z'
ch <= 'Z'Description
TRUEevaluated 1071 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
72-1143
422 && !(ch == '_')
!(ch == '_')Description
TRUEevaluated 463 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_QTimeZone
68-463
423 && !(ch == '.')
!(ch == '.')Description
TRUEevaluated 458 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QTimeZone
5-458
424-
425 && !(ch >= '0'
ch >= '0'Description
TRUEevaluated 404 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& ch <= '9'
ch <= '9'Description
TRUEevaluated 352 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
52-404
426 && !(ch == '+')
!(ch == '+')Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QTimeZone
25-81
427 && !(ch == ':')
!(ch == ':')Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_QTimeZone
) {
39-42
428 return
executed 39 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 39 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
39
429 }-
430 }
executed 7660 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
7660
431 if (sectionLength < MinSectionLength
sectionLength ...nSectionLengthDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 517 times by 1 test
Evaluated by:
  • tst_QTimeZone
|| sectionLength > MaxSectionLength
sectionLength ...xSectionLengthDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 514 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-517
432 return
executed 4 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
4
433 return
executed 514 times by 1 test: return true;
Executed by:
  • tst_QTimeZone
true;
executed 514 times by 1 test: return true;
Executed by:
  • tst_QTimeZone
514
434}-
435-
436QString QTimeZonePrivate::isoOffsetFormat(int offsetFromUtc)-
437{-
438 const int mins = offsetFromUtc / 60;-
439 return
executed 7 times by 2 tests: return QString::fromUtf8("UTC%1%2:%3").arg(mins >= 0 ? QLatin1Char('+') : QLatin1Char('-')) .arg(qAbs(mins) / 60, 2, 10, QLatin1Char('0')) .arg(qAbs(mins) % 60, 2, 10, QLatin1Char('0'));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
QString::fromUtf8("UTC%1%2:%3").arg(mins >= 0 ? QLatin1Char('+') : QLatin1Char('-'))
executed 7 times by 2 tests: return QString::fromUtf8("UTC%1%2:%3").arg(mins >= 0 ? QLatin1Char('+') : QLatin1Char('-')) .arg(qAbs(mins) / 60, 2, 10, QLatin1Char('0')) .arg(qAbs(mins) % 60, 2, 10, QLatin1Char('0'));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7
440 .arg(qAbs(mins) / 60, 2, 10, QLatin1Char('0'))
executed 7 times by 2 tests: return QString::fromUtf8("UTC%1%2:%3").arg(mins >= 0 ? QLatin1Char('+') : QLatin1Char('-')) .arg(qAbs(mins) / 60, 2, 10, QLatin1Char('0')) .arg(qAbs(mins) % 60, 2, 10, QLatin1Char('0'));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7
441 .arg(qAbs(mins) % 60, 2, 10, QLatin1Char('0'));
executed 7 times by 2 tests: return QString::fromUtf8("UTC%1%2:%3").arg(mins >= 0 ? QLatin1Char('+') : QLatin1Char('-')) .arg(qAbs(mins) / 60, 2, 10, QLatin1Char('0')) .arg(qAbs(mins) % 60, 2, 10, QLatin1Char('0'));
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7
442}-
443-
444QByteArray QTimeZonePrivate::ianaIdToWindowsId(const QByteArray &id)-
445{-
446 for (int i = 0; i < zoneDataTableSize
i < zoneDataTableSizeDescription
TRUEevaluated 1655 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
3-1655
447 const QZoneData *data = zoneData(i);-
448 if (ianaId(data).split(' ').contains(id)
ianaId(data).s...).contains(id)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1653 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
2-1653
449 return
executed 2 times by 1 test: return toWindowsIdLiteral(data->windowsIdKey);
Executed by:
  • tst_QTimeZone
toWindowsIdLiteral(data->windowsIdKey);
executed 2 times by 1 test: return toWindowsIdLiteral(data->windowsIdKey);
Executed by:
  • tst_QTimeZone
2
450 }
executed 1653 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
1653
451 return
executed 3 times by 1 test: return QByteArray();
Executed by:
  • tst_QTimeZone
QByteArray();
executed 3 times by 1 test: return QByteArray();
Executed by:
  • tst_QTimeZone
3
452}-
453-
454QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId)-
455{-
456 const quint16 windowsIdKey = toWindowsIdKey(windowsId);-
457 for (int i = 0; i < windowsDataTableSize
i < windowsDataTableSizeDescription
TRUEevaluated 132 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
1-132
458 const QWindowsData *data = windowsData(i);-
459 if (data->windowsIdKey == windowsIdKey
data->windowsI...= windowsIdKeyDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 131 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-131
460 return
executed 1 time by 1 test: return ianaId(data);
Executed by:
  • tst_QTimeZone
ianaId(data);
executed 1 time by 1 test: return ianaId(data);
Executed by:
  • tst_QTimeZone
1
461 }
executed 131 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
131
462 return
executed 1 time by 1 test: return QByteArray();
Executed by:
  • tst_QTimeZone
QByteArray();
executed 1 time by 1 test: return QByteArray();
Executed by:
  • tst_QTimeZone
1
463}-
464-
465QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId,-
466 QLocale::Country country)-
467{-
468 const QList<QByteArray> list = windowsIdToIanaIds(windowsId, country);-
469 if (list.count() > 0
list.count() > 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
)
0-2
470 return
executed 2 times by 1 test: return list.first();
Executed by:
  • tst_QTimeZone
list.first();
executed 2 times by 1 test: return list.first();
Executed by:
  • tst_QTimeZone
2
471 else-
472 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
473}-
474-
475QList<QByteArray> QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId)-
476{-
477 const quint16 windowsIdKey = toWindowsIdKey(windowsId);-
478 QList<QByteArray> list;-
479-
480 for (int i = 0; i < zoneDataTableSize
i < zoneDataTableSizeDescription
TRUEevaluated 688 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
2-688
481 const QZoneData *data = zoneData(i);-
482 if (data->windowsIdKey == windowsIdKey
data->windowsI...= windowsIdKeyDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 684 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
4-684
483 list << ianaId(data).split(' ');
executed 4 times by 1 test: list << ianaId(data).split(' ');
Executed by:
  • tst_QTimeZone
4
484 }
executed 688 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
688
485-
486-
487 std::sort(list.begin(), list.end());-
488 return
executed 2 times by 1 test: return list;
Executed by:
  • tst_QTimeZone
list;
executed 2 times by 1 test: return list;
Executed by:
  • tst_QTimeZone
2
489}-
490-
491QList<QByteArray> QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId,-
492 QLocale::Country country)-
493{-
494 const quint16 windowsIdKey = toWindowsIdKey(windowsId);-
495 for (int i = 0; i < zoneDataTableSize
i < zoneDataTableSizeDescription
TRUEevaluated 2467 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
2-2467
496 const QZoneData *data = zoneData(i);-
497-
498 if (data->windowsIdKey == windowsIdKey
data->windowsI...= windowsIdKeyDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 2450 times by 1 test
Evaluated by:
  • tst_QTimeZone
&& data->country == (quint16) country
data->country ...int16) countryDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
6-2450
499 return
executed 6 times by 1 test: return ianaId(data).split(' ');
Executed by:
  • tst_QTimeZone
ianaId(data).split(' ');
executed 6 times by 1 test: return ianaId(data).split(' ');
Executed by:
  • tst_QTimeZone
6
500 }
executed 2461 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
2461
501-
502 return
executed 2 times by 1 test: return QList<QByteArray>();
Executed by:
  • tst_QTimeZone
QList<QByteArray>();
executed 2 times by 1 test: return QList<QByteArray>();
Executed by:
  • tst_QTimeZone
2
503}-
504-
505-
506template<> QTimeZonePrivate *QSharedDataPointer<QTimeZonePrivate>::clone()-
507{-
508 return
executed 20 times by 1 test: return d->clone();
Executed by:
  • tst_QDateTime
d->clone();
executed 20 times by 1 test: return d->clone();
Executed by:
  • tst_QDateTime
20
509}-
510-
511-
512-
513-
514-
515-
516-
517QUtcTimeZonePrivate::QUtcTimeZonePrivate()-
518{-
519 const QString name = utcQString();-
520 init(utcQByteArray(), 0, name, name, QLocale::AnyCountry, name);-
521}
executed 470 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
470
522-
523-
524QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QByteArray &id)-
525{-
526-
527 for (int i = 0; i < utcDataTableSize
i < utcDataTableSizeDescription
TRUEevaluated 18897 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 450 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
; ++i) {
450-18897
528 const QUtcData *data = utcData(i);-
529 const QByteArray uid = utcId(data);-
530 if (uid == id
uid == idDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 18851 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
46-18851
531 QString name = QString::fromUtf8(id);-
532 init(id, data->offsetFromUtc, name, name, QLocale::AnyCountry, name);-
533 break;
executed 46 times by 1 test: break;
Executed by:
  • tst_QTimeZone
46
534 }-
535 }
executed 18851 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
18851
536}
executed 496 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
496
537-
538-
539QUtcTimeZonePrivate::QUtcTimeZonePrivate(qint32 offsetSeconds)-
540{-
541 QString utcId;-
542-
543 if (offsetSeconds == 0
offsetSeconds == 0Description
TRUEnever evaluated
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
)
0-7
544 utcId = utcQString();
never executed: utcId = utcQString();
0
545 else-
546 utcId = isoOffsetFormat(offsetSeconds);
executed 7 times by 2 tests: utcId = isoOffsetFormat(offsetSeconds);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7
547-
548 init(utcId.toUtf8(), offsetSeconds, utcId, utcId, QLocale::AnyCountry, utcId);-
549}
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7
550-
551QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QByteArray &zoneId, int offsetSeconds,-
552 const QString &name, const QString &abbreviation,-
553 QLocale::Country country, const QString &comment)-
554{-
555 init(zoneId, offsetSeconds, name, abbreviation, country, comment);-
556}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
3
557-
558QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QUtcTimeZonePrivate &other)-
559 : QTimeZonePrivate(other), m_name(other.m_name),-
560 m_abbreviation(other.m_abbreviation),-
561 m_comment(other.m_comment),-
562 m_country(other.m_country),-
563 m_offsetFromUtc(other.m_offsetFromUtc)-
564{-
565}
never executed: end of block
0
566-
567QUtcTimeZonePrivate::~QUtcTimeZonePrivate()-
568{-
569}-
570-
571QTimeZonePrivate *QUtcTimeZonePrivate::clone()-
572{-
573 return
never executed: return new QUtcTimeZonePrivate(*this);
new QUtcTimeZonePrivate(*this);
never executed: return new QUtcTimeZonePrivate(*this);
0
574}-
575-
576QTimeZonePrivate::Data QUtcTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const-
577{-
578 Data d;-
579 d.abbreviation = m_abbreviation;-
580 d.atMSecsSinceEpoch = forMSecsSinceEpoch;-
581 d.standardTimeOffset = d.offsetFromUtc = m_offsetFromUtc;-
582 d.daylightTimeOffset = 0;-
583 return
executed 85 times by 2 tests: return d;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
d;
executed 85 times by 2 tests: return d;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
85
584}-
585-
586void QUtcTimeZonePrivate::init(const QByteArray &zoneId)-
587{-
588 m_id = zoneId;-
589}
never executed: end of block
0
590-
591void QUtcTimeZonePrivate::init(const QByteArray &zoneId, int offsetSeconds, const QString &name,-
592 const QString &abbreviation, QLocale::Country country,-
593 const QString &comment)-
594{-
595 m_id = zoneId;-
596 m_offsetFromUtc = offsetSeconds;-
597 m_name = name;-
598 m_abbreviation = abbreviation;-
599 m_country = country;-
600 m_comment = comment;-
601}
executed 526 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
526
602-
603QLocale::Country QUtcTimeZonePrivate::country() const-
604{-
605 return
executed 43 times by 1 test: return m_country;
Executed by:
  • tst_QTimeZone
m_country;
executed 43 times by 1 test: return m_country;
Executed by:
  • tst_QTimeZone
43
606}-
607-
608QString QUtcTimeZonePrivate::comment() const-
609{-
610 return
executed 42 times by 1 test: return m_comment;
Executed by:
  • tst_QTimeZone
m_comment;
executed 42 times by 1 test: return m_comment;
Executed by:
  • tst_QTimeZone
42
611}-
612-
613QString QUtcTimeZonePrivate::displayName(QTimeZone::TimeType timeType,-
614 QTimeZone::NameType nameType,-
615 const QLocale &locale) const-
616{-
617 (void)timeType;-
618 (void)locale;-
619 if (nameType == QTimeZone::ShortName
nameType == QT...one::ShortNameDescription
TRUEnever evaluated
FALSEevaluated 124 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-124
620 return
never executed: return m_abbreviation;
m_abbreviation;
never executed: return m_abbreviation;
0
621 else if (nameType == QTimeZone::OffsetName
nameType == QT...ne::OffsetNameDescription
TRUEnever evaluated
FALSEevaluated 124 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-124
622 return
never executed: return isoOffsetFormat(m_offsetFromUtc);
isoOffsetFormat(m_offsetFromUtc);
never executed: return isoOffsetFormat(m_offsetFromUtc);
0
623 return
executed 124 times by 1 test: return m_name;
Executed by:
  • tst_QTimeZone
m_name;
executed 124 times by 1 test: return m_name;
Executed by:
  • tst_QTimeZone
124
624}-
625-
626QString QUtcTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const-
627{-
628 (void)atMSecsSinceEpoch;-
629 return
executed 83 times by 1 test: return m_abbreviation;
Executed by:
  • tst_QTimeZone
m_abbreviation;
executed 83 times by 1 test: return m_abbreviation;
Executed by:
  • tst_QTimeZone
83
630}-
631-
632qint32 QUtcTimeZonePrivate::standardTimeOffset(qint64 atMSecsSinceEpoch) const-
633{-
634 (void)atMSecsSinceEpoch;-
635 return
executed 172 times by 2 tests: return m_offsetFromUtc;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
m_offsetFromUtc;
executed 172 times by 2 tests: return m_offsetFromUtc;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
172
636}-
637-
638qint32 QUtcTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const-
639{-
640 (void)atMSecsSinceEpoch;-
641 return
executed 46 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
0;
executed 46 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
46
642}-
643-
644QByteArray QUtcTimeZonePrivate::systemTimeZoneId() const-
645{-
646 return
never executed: return utcQByteArray();
utcQByteArray();
never executed: return utcQByteArray();
0
647}-
648-
649QList<QByteArray> QUtcTimeZonePrivate::availableTimeZoneIds() const-
650{-
651 QList<QByteArray> result;-
652 result.reserve(utcDataTableSize);-
653 for (int i = 0; i < utcDataTableSize
i < utcDataTableSizeDescription
TRUEevaluated 18680 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 467 times by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i)
467-18680
654 result << utcId(utcData(i));
executed 18680 times by 1 test: result << utcId(utcData(i));
Executed by:
  • tst_QTimeZone
18680
655 std::sort(result.begin(), result.end());-
656-
657 return
executed 467 times by 1 test: return result;
Executed by:
  • tst_QTimeZone
result;
executed 467 times by 1 test: return result;
Executed by:
  • tst_QTimeZone
467
658}-
659-
660QList<QByteArray> QUtcTimeZonePrivate::availableTimeZoneIds(QLocale::Country country) const-
661{-
662-
663 if (country == QLocale::AnyCountry
country == QLocale::AnyCountryDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-1
664 return
never executed: return availableTimeZoneIds();
availableTimeZoneIds();
never executed: return availableTimeZoneIds();
0
665 return
executed 1 time by 1 test: return QList<QByteArray>();
Executed by:
  • tst_QTimeZone
QList<QByteArray>();
executed 1 time by 1 test: return QList<QByteArray>();
Executed by:
  • tst_QTimeZone
1
666}-
667-
668QList<QByteArray> QUtcTimeZonePrivate::availableTimeZoneIds(qint32 offsetSeconds) const-
669{-
670 QList<QByteArray> result;-
671 for (int i = 0; i < utcDataTableSize
i < utcDataTableSizeDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
; ++i) {
1-40
672 const QUtcData *data = utcData(i);-
673 if (data->offsetFromUtc == offsetSeconds
data->offsetFr... offsetSecondsDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 37 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
3-37
674 result << utcId(data);
executed 3 times by 1 test: result << utcId(data);
Executed by:
  • tst_QTimeZone
3
675 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
40
676 std::sort(result.begin(), result.end());-
677-
678 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
679}-
680-
681-
682void QUtcTimeZonePrivate::serialize(QDataStream &ds) const-
683{-
684 ds << ([]() -> QString { enum { Size = sizeof(u"" "OffsetFromUtc")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "OffsetFromUtc" }; 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
}()) << QString::fromUtf8(m_id) << m_offsetFromUtc << m_name
1
685 << m_abbreviation << (qint32) m_country << m_comment;-
686}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTimeZone
1
687-
688-
689-
Switch to Source codePreprocessed file

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