OpenCoverage

qtimezone.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qtimezone.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static QTimeZonePrivate *newBackendTimeZone()-
10{-
11 return
executed 1 time by 1 test: return new QTzTimeZonePrivate();
Executed by:
  • tst_QTimeZone
new QTzTimeZonePrivate();
executed 1 time by 1 test: return new QTzTimeZonePrivate();
Executed by:
  • tst_QTimeZone
1
12}-
13-
14-
15static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)-
16{-
17 return
executed 450 times by 2 tests: return new QTzTimeZonePrivate(ianaId);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
new QTzTimeZonePrivate(ianaId);
executed 450 times by 2 tests: return new QTzTimeZonePrivate(ianaId);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
450
18}-
19-
20class QTimeZoneSingleton-
21{-
22public:-
23 QTimeZoneSingleton() : backend(newBackendTimeZone()) {}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTimeZone
1
24-
25-
26-
27-
28-
29 QSharedDataPointer<QTimeZonePrivate> backend;-
30};-
31-
32namespace { namespace Q_QGS_global_tz { typedef QTimeZoneSingleton 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 ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 469 times by 1 test: return &holder.value;
Executed by:
  • tst_QTimeZone
&holder.value;
executed 469 times by 1 test: return &holder.value;
Executed by:
  • tst_QTimeZone
} } } static QGlobalStatic<QTimeZoneSingleton, Q_QGS_global_tz::innerFunction, Q_QGS_global_tz::guard> global_tz;;
0-469
33QTimeZone::QTimeZone() noexcept-
34 : d(0)-
35{-
36}
executed 7098826 times by 128 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSlider
  • tst_QAccessibility
  • tst_QAsn1Element
  • tst_QAtomicInt
  • tst_QAuthenticator
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDataStream
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
7098826
37QTimeZone::QTimeZone(const QByteArray &ianaId)-
38{-
39-
40 d = new QUtcTimeZonePrivate(ianaId);-
41-
42-
43 if (!d->isValid()
!d->isValid()Description
TRUEevaluated 450 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
44-450
44 d = newBackendTimeZone(ianaId);
executed 450 times by 2 tests: d = newBackendTimeZone(ianaId);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
450
45}
executed 494 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
494
46QTimeZone::QTimeZone(int offsetSeconds)-
47{-
48-
49 if (offsetSeconds >= -50400
offsetSeconds >= -50400Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
&& offsetSeconds <= 50400
offsetSeconds <= 50400Description
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-8
50 d = new QUtcTimeZonePrivate(offsetSeconds);
executed 7 times by 2 tests: d = new QUtcTimeZonePrivate(offsetSeconds);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
7
51 else-
52 d = 0;
executed 2 times by 1 test: d = 0;
Executed by:
  • tst_QTimeZone
2
53}-
54QTimeZone::QTimeZone(const QByteArray &ianaId, int offsetSeconds, const QString &name,-
55 const QString &abbreviation, QLocale::Country country, const QString &comment)-
56 : d()-
57{-
58 if (!isTimeZoneIdAvailable(ianaId)
!isTimeZoneIdAvailable(ianaId)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
)
0-3
59 d = new QUtcTimeZonePrivate(ianaId, offsetSeconds, name, abbreviation, country, comment);
executed 3 times by 1 test: d = new QUtcTimeZonePrivate(ianaId, offsetSeconds, name, abbreviation, country, comment);
Executed by:
  • tst_QTimeZone
3
60}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QTimeZone
3
61-
62-
63-
64-
65-
66-
67-
68QTimeZone::QTimeZone(QTimeZonePrivate &dd)-
69 : d(&dd)-
70{-
71}
never executed: end of block
0
72-
73-
74-
75-
76-
77QTimeZone::QTimeZone(const QTimeZone &other)-
78 : d(other.d)-
79{-
80}
executed 7013235 times by 103 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSlider
  • tst_QAccessibility
  • tst_QAtomicInt
  • tst_QAuthenticator
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDebug
  • tst_QDir
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • ...
7013235
81-
82-
83-
84-
85-
86QTimeZone::~QTimeZone()-
87{-
88}-
89QTimeZone &QTimeZone::operator=(const QTimeZone &other)-
90{-
91 d = other.d;-
92 return
executed 485 times by 2 tests: return *this;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
*this;
executed 485 times by 2 tests: return *this;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
485
93}-
94bool QTimeZone::operator==(const QTimeZone &other) const-
95{-
96 if (d && other.d)-
97 return
executed 19 times by 2 tests: return (*d == *other.d);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
(*d == *other.d);
executed 19 times by 2 tests: return (*d == *other.d);
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
19
98 else-
99 return
executed 2 times by 1 test: return (d == other.d);
Executed by:
  • tst_QTimeZone
(d == other.d);
executed 2 times by 1 test: return (d == other.d);
Executed by:
  • tst_QTimeZone
2
100}-
101-
102-
103-
104-
105-
106bool QTimeZone::operator!=(const QTimeZone &other) const-
107{-
108 if (d && other.d)-
109 return
executed 2 times by 1 test: return (*d != *other.d);
Executed by:
  • tst_QTimeZone
(*d != *other.d);
executed 2 times by 1 test: return (*d != *other.d);
Executed by:
  • tst_QTimeZone
2
110 else-
111 return
executed 2 times by 1 test: return (d != other.d);
Executed by:
  • tst_QTimeZone
(d != other.d);
executed 2 times by 1 test: return (d != other.d);
Executed by:
  • tst_QTimeZone
2
112}-
113-
114-
115-
116-
117-
118bool QTimeZone::isValid() const-
119{-
120 if (d
dDescription
TRUEevaluated 11641 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
23-11641
121 return
executed 11641 times by 2 tests: return d->isValid();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
d->isValid();
executed 11641 times by 2 tests: return d->isValid();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
11641
122 else-
123 return
executed 23 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 23 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
23
124}-
125QByteArray QTimeZone::id() const-
126{-
127 if (d
dDescription
TRUEevaluated 469 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-469
128 return
executed 469 times by 2 tests: return d->id();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
d->id();
executed 469 times by 2 tests: return d->id();
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
469
129 else-
130 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
131}-
132-
133-
134-
135-
136-
137QLocale::Country QTimeZone::country() const-
138{-
139 if (isValid()
isValid()Description
TRUEevaluated 464 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-464
140 return
executed 464 times by 1 test: return d->country();
Executed by:
  • tst_QTimeZone
d->country();
executed 464 times by 1 test: return d->country();
Executed by:
  • tst_QTimeZone
464
141 else-
142 return
executed 1 time by 1 test: return QLocale::AnyCountry;
Executed by:
  • tst_QTimeZone
QLocale::AnyCountry;
executed 1 time by 1 test: return QLocale::AnyCountry;
Executed by:
  • tst_QTimeZone
1
143}-
144QString QTimeZone::comment() const-
145{-
146 if (isValid()
isValid()Description
TRUEevaluated 463 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-463
147 return
executed 463 times by 1 test: return d->comment();
Executed by:
  • tst_QTimeZone
d->comment();
executed 463 times by 1 test: return d->comment();
Executed by:
  • tst_QTimeZone
463
148 else-
149 return
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
QString();
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
1
150}-
151QString QTimeZone::displayName(const QDateTime &atDateTime, NameType nameType,-
152 const QLocale &locale) const-
153{-
154 if (isValid()
isValid()Description
TRUEevaluated 461 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-461
155 return
executed 461 times by 1 test: return d->displayName(atDateTime.toMSecsSinceEpoch(), nameType, locale);
Executed by:
  • tst_QTimeZone
d->displayName(atDateTime.toMSecsSinceEpoch(), nameType, locale);
executed 461 times by 1 test: return d->displayName(atDateTime.toMSecsSinceEpoch(), nameType, locale);
Executed by:
  • tst_QTimeZone
461
156 else-
157 return
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
QString();
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
1
158}-
159QString QTimeZone::displayName(TimeType timeType, NameType nameType,-
160 const QLocale &locale) const-
161{-
162 if (isValid()
isValid()Description
TRUEevaluated 925 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-925
163 return
executed 925 times by 1 test: return d->displayName(timeType, nameType, locale);
Executed by:
  • tst_QTimeZone
d->displayName(timeType, nameType, locale);
executed 925 times by 1 test: return d->displayName(timeType, nameType, locale);
Executed by:
  • tst_QTimeZone
925
164 else-
165 return
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
QString();
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
1
166}-
167QString QTimeZone::abbreviation(const QDateTime &atDateTime) const-
168{-
169 if (isValid()
isValid()Description
TRUEevaluated 463 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
)
1-463
170 return
executed 463 times by 1 test: return d->abbreviation(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
d->abbreviation(atDateTime.toMSecsSinceEpoch());
executed 463 times by 1 test: return d->abbreviation(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
463
171 else-
172 return
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
QString();
executed 1 time by 1 test: return QString();
Executed by:
  • tst_QTimeZone
1
173}-
174int QTimeZone::offsetFromUtc(const QDateTime &atDateTime) const-
175{-
176 if (isValid()
isValid()Description
TRUEevaluated 467 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
2-467
177 return
executed 467 times by 1 test: return d->offsetFromUtc(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
d->offsetFromUtc(atDateTime.toMSecsSinceEpoch());
executed 467 times by 1 test: return d->offsetFromUtc(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
467
178 else-
179 return
executed 2 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
0;
executed 2 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
2
180}-
181int QTimeZone::standardTimeOffset(const QDateTime &atDateTime) const-
182{-
183 if (isValid()
isValid()Description
TRUEevaluated 466 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
2-466
184 return
executed 466 times by 1 test: return d->standardTimeOffset(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
d->standardTimeOffset(atDateTime.toMSecsSinceEpoch());
executed 466 times by 1 test: return d->standardTimeOffset(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
466
185 else-
186 return
executed 2 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
0;
executed 2 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
2
187}-
188int QTimeZone::daylightTimeOffset(const QDateTime &atDateTime) const-
189{-
190 if (hasDaylightTime()
hasDaylightTime()Description
TRUEevaluated 291 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 177 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
177-291
191 return
executed 291 times by 1 test: return d->daylightTimeOffset(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
d->daylightTimeOffset(atDateTime.toMSecsSinceEpoch());
executed 291 times by 1 test: return d->daylightTimeOffset(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
291
192 else-
193 return
executed 177 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
0;
executed 177 times by 1 test: return 0;
Executed by:
  • tst_QTimeZone
177
194}-
195-
196-
197-
198-
199-
200-
201-
202bool QTimeZone::hasDaylightTime() const-
203{-
204 if (isValid()
isValid()Description
TRUEevaluated 1391 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
5-1391
205 return
executed 1391 times by 1 test: return d->hasDaylightTime();
Executed by:
  • tst_QTimeZone
d->hasDaylightTime();
executed 1391 times by 1 test: return d->hasDaylightTime();
Executed by:
  • tst_QTimeZone
1391
206 else-
207 return
executed 5 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 5 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
5
208}-
209-
210-
211-
212-
213-
214-
215-
216bool QTimeZone::isDaylightTime(const QDateTime &atDateTime) const-
217{-
218 if (hasDaylightTime()
hasDaylightTime()Description
TRUEevaluated 291 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 174 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
174-291
219 return
executed 291 times by 1 test: return d->isDaylightTime(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
d->isDaylightTime(atDateTime.toMSecsSinceEpoch());
executed 291 times by 1 test: return d->isDaylightTime(atDateTime.toMSecsSinceEpoch());
Executed by:
  • tst_QTimeZone
291
220 else-
221 return
executed 174 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
false;
executed 174 times by 1 test: return false;
Executed by:
  • tst_QTimeZone
174
222}-
223QTimeZone::OffsetData QTimeZone::offsetData(const QDateTime &forDateTime) const-
224{-
225 if (hasTransitions()
hasTransitions()Description
TRUEevaluated 421 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 41 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
41-421
226 return
executed 421 times by 1 test: return d->toOffsetData(d->data(forDateTime.toMSecsSinceEpoch()));
Executed by:
  • tst_QTimeZone
d->toOffsetData(d->data(forDateTime.toMSecsSinceEpoch()));
executed 421 times by 1 test: return d->toOffsetData(d->data(forDateTime.toMSecsSinceEpoch()));
Executed by:
  • tst_QTimeZone
421
227 else-
228 return
executed 41 times by 1 test: return d->invalidOffsetData();
Executed by:
  • tst_QTimeZone
d->invalidOffsetData();
executed 41 times by 1 test: return d->invalidOffsetData();
Executed by:
  • tst_QTimeZone
41
229}-
230bool QTimeZone::hasTransitions() const-
231{-
232 if (isValid()
isValid()Description
TRUEevaluated 5538 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
4-5538
233 return
executed 5538 times by 1 test: return d->hasTransitions();
Executed by:
  • tst_QTimeZone
d->hasTransitions();
executed 5538 times by 1 test: return d->hasTransitions();
Executed by:
  • tst_QTimeZone
5538
234 else-
235 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
236}-
237QTimeZone::OffsetData QTimeZone::nextTransition(const QDateTime &afterDateTime) const-
238{-
239 if (hasTransitions()
hasTransitions()Description
TRUEevaluated 2107 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 201 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
201-2107
240 return
executed 2107 times by 1 test: return d->toOffsetData(d->nextTransition(afterDateTime.toMSecsSinceEpoch()));
Executed by:
  • tst_QTimeZone
d->toOffsetData(d->nextTransition(afterDateTime.toMSecsSinceEpoch()));
executed 2107 times by 1 test: return d->toOffsetData(d->nextTransition(afterDateTime.toMSecsSinceEpoch()));
Executed by:
  • tst_QTimeZone
2107
241 else-
242 return
executed 201 times by 1 test: return d->invalidOffsetData();
Executed by:
  • tst_QTimeZone
d->invalidOffsetData();
executed 201 times by 1 test: return d->invalidOffsetData();
Executed by:
  • tst_QTimeZone
201
243}-
244QTimeZone::OffsetData QTimeZone::previousTransition(const QDateTime &beforeDateTime) const-
245{-
246 if (hasTransitions()
hasTransitions()Description
TRUEevaluated 2107 times by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 201 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
201-2107
247 return
executed 2107 times by 1 test: return d->toOffsetData(d->previousTransition(beforeDateTime.toMSecsSinceEpoch()));
Executed by:
  • tst_QTimeZone
d->toOffsetData(d->previousTransition(beforeDateTime.toMSecsSinceEpoch()));
executed 2107 times by 1 test: return d->toOffsetData(d->previousTransition(beforeDateTime.toMSecsSinceEpoch()));
Executed by:
  • tst_QTimeZone
2107
248 else-
249 return
executed 201 times by 1 test: return d->invalidOffsetData();
Executed by:
  • tst_QTimeZone
d->invalidOffsetData();
executed 201 times by 1 test: return d->invalidOffsetData();
Executed by:
  • tst_QTimeZone
201
250}-
251QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime,-
252 const QDateTime &toDateTime) const-
253{-
254 OffsetDataList list;-
255 if (hasTransitions()
hasTransitions()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEnever evaluated
) {
0-1
256 const QTimeZonePrivate::DataList plist = d->transitions(fromDateTime.toMSecsSinceEpoch(),-
257 toDateTime.toMSecsSinceEpoch());-
258 list.reserve(plist.count());-
259 for (const QTimeZonePrivate::Data &pdata : plist)-
260 list.append(d->toOffsetData(pdata));
executed 2 times by 1 test: list.append(d->toOffsetData(pdata));
Executed by:
  • tst_QTimeZone
2
261 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTimeZone
1
262 return
executed 1 time by 1 test: return list;
Executed by:
  • tst_QTimeZone
list;
executed 1 time by 1 test: return list;
Executed by:
  • tst_QTimeZone
1
263}-
264QByteArray QTimeZone::systemTimeZoneId()-
265{-
266 return
never executed: return global_tz->backend->systemTimeZoneId();
global_tz->backend->systemTimeZoneId();
never executed: return global_tz->backend->systemTimeZoneId();
0
267}-
268QTimeZone QTimeZone::systemTimeZone()-
269{-
270 return
never executed: return QTimeZone(QTimeZone::systemTimeZoneId());
QTimeZone(QTimeZone::systemTimeZoneId());
never executed: return QTimeZone(QTimeZone::systemTimeZoneId());
0
271}-
272-
273-
274-
275-
276-
277-
278-
279QTimeZone QTimeZone::utc()-
280{-
281 return
never executed: return QTimeZone(QTimeZonePrivate::utcQByteArray());
QTimeZone(QTimeZonePrivate::utcQByteArray());
never executed: return QTimeZone(QTimeZonePrivate::utcQByteArray());
0
282}-
283-
284-
285-
286-
287-
288-
289-
290bool QTimeZone::isTimeZoneIdAvailable(const QByteArray &ianaId)-
291{-
292-
293-
294 if (!QTimeZonePrivate::isValidId(ianaId)
!QTimeZonePriv...alidId(ianaId)Description
TRUEnever evaluated
FALSEevaluated 464 times by 1 test
Evaluated by:
  • tst_QTimeZone
)
0-464
295 return
never executed: return false;
false;
never executed: return false;
0
296 const QList<QByteArray> tzIds = availableTimeZoneIds();-
297 return
executed 464 times by 1 test: return std::binary_search(tzIds.begin(), tzIds.end(), ianaId);
Executed by:
  • tst_QTimeZone
std::binary_search(tzIds.begin(), tzIds.end(), ianaId);
executed 464 times by 1 test: return std::binary_search(tzIds.begin(), tzIds.end(), ianaId);
Executed by:
  • tst_QTimeZone
464
298}-
299-
300static QList<QByteArray> set_union(const QList<QByteArray> &l1, const QList<QByteArray> &l2)-
301{-
302 QList<QByteArray> result;-
303 result.reserve(l1.size() + l2.size());-
304 std::set_union(l1.begin(), l1.end(),-
305 l2.begin(), l2.end(),-
306 std::back_inserter(result));-
307 return
executed 469 times by 1 test: return result;
Executed by:
  • tst_QTimeZone
result;
executed 469 times by 1 test: return result;
Executed by:
  • tst_QTimeZone
469
308}-
309-
310-
311-
312-
313-
314-
315-
316QList<QByteArray> QTimeZone::availableTimeZoneIds()-
317{-
318 return
executed 467 times by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(), global_tz->backend->availableTimeZoneIds());
Executed by:
  • tst_QTimeZone
set_union(QUtcTimeZonePrivate().availableTimeZoneIds(),
executed 467 times by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(), global_tz->backend->availableTimeZoneIds());
Executed by:
  • tst_QTimeZone
467
319 global_tz->backend->availableTimeZoneIds());
executed 467 times by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(), global_tz->backend->availableTimeZoneIds());
Executed by:
  • tst_QTimeZone
467
320}-
321QList<QByteArray> QTimeZone::availableTimeZoneIds(QLocale::Country country)-
322{-
323 return
executed 1 time by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(country), global_tz->backend->availableTimeZoneIds(country));
Executed by:
  • tst_QTimeZone
set_union(QUtcTimeZonePrivate().availableTimeZoneIds(country),
executed 1 time by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(country), global_tz->backend->availableTimeZoneIds(country));
Executed by:
  • tst_QTimeZone
1
324 global_tz->backend->availableTimeZoneIds(country));
executed 1 time by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(country), global_tz->backend->availableTimeZoneIds(country));
Executed by:
  • tst_QTimeZone
1
325}-
326QList<QByteArray> QTimeZone::availableTimeZoneIds(int offsetSeconds)-
327{-
328 return
executed 1 time by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(offsetSeconds), global_tz->backend->availableTimeZoneIds(offsetSeconds));
Executed by:
  • tst_QTimeZone
set_union(QUtcTimeZonePrivate().availableTimeZoneIds(offsetSeconds),
executed 1 time by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(offsetSeconds), global_tz->backend->availableTimeZoneIds(offsetSeconds));
Executed by:
  • tst_QTimeZone
1
329 global_tz->backend->availableTimeZoneIds(offsetSeconds));
executed 1 time by 1 test: return set_union(QUtcTimeZonePrivate().availableTimeZoneIds(offsetSeconds), global_tz->backend->availableTimeZoneIds(offsetSeconds));
Executed by:
  • tst_QTimeZone
1
330}-
331-
332-
333-
334-
335-
336-
337-
338QByteArray QTimeZone::ianaIdToWindowsId(const QByteArray &ianaId)-
339{-
340 return
executed 5 times by 1 test: return QTimeZonePrivate::ianaIdToWindowsId(ianaId);
Executed by:
  • tst_QTimeZone
QTimeZonePrivate::ianaIdToWindowsId(ianaId);
executed 5 times by 1 test: return QTimeZonePrivate::ianaIdToWindowsId(ianaId);
Executed by:
  • tst_QTimeZone
5
341}-
342QByteArray QTimeZone::windowsIdToDefaultIanaId(const QByteArray &windowsId)-
343{-
344 return
executed 2 times by 1 test: return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId);
Executed by:
  • tst_QTimeZone
QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId);
executed 2 times by 1 test: return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId);
Executed by:
  • tst_QTimeZone
2
345}-
346QByteArray QTimeZone::windowsIdToDefaultIanaId(const QByteArray &windowsId,-
347 QLocale::Country country)-
348{-
349 return
executed 2 times by 1 test: return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId, country);
Executed by:
  • tst_QTimeZone
QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId, country);
executed 2 times by 1 test: return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId, country);
Executed by:
  • tst_QTimeZone
2
350}-
351QList<QByteArray> QTimeZone::windowsIdToIanaIds(const QByteArray &windowsId)-
352{-
353 return
executed 2 times by 1 test: return QTimeZonePrivate::windowsIdToIanaIds(windowsId);
Executed by:
  • tst_QTimeZone
QTimeZonePrivate::windowsIdToIanaIds(windowsId);
executed 2 times by 1 test: return QTimeZonePrivate::windowsIdToIanaIds(windowsId);
Executed by:
  • tst_QTimeZone
2
354}-
355QList<QByteArray> QTimeZone::windowsIdToIanaIds(const QByteArray &windowsId,-
356 QLocale::Country country)-
357{-
358 return
executed 6 times by 1 test: return QTimeZonePrivate::windowsIdToIanaIds(windowsId, country);
Executed by:
  • tst_QTimeZone
QTimeZonePrivate::windowsIdToIanaIds(windowsId, country);
executed 6 times by 1 test: return QTimeZonePrivate::windowsIdToIanaIds(windowsId, country);
Executed by:
  • tst_QTimeZone
6
359}-
360-
361-
362QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz)-
363{-
364 tz.d->serialize(ds);-
365 return
executed 3 times by 2 tests: return ds;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
ds;
executed 3 times by 2 tests: return ds;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3
366}-
367-
368QDataStream &operator>>(QDataStream &ds, QTimeZone &tz)-
369{-
370 QString ianaId;-
371 ds >> ianaId;-
372 if (ianaId == QLatin1String("OffsetFromUtc")
ianaId == QLat...ffsetFromUtc")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTimeZone
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTimeZone
) {
1-2
373 int utcOffset;-
374 QString name;-
375 QString abbreviation;-
376 int country;-
377 QString comment;-
378 ds >> ianaId >> utcOffset >> name >> abbreviation >> country >> comment;-
379 tz = QTimeZone(ianaId.toUtf8(), utcOffset, name, abbreviation, (QLocale::Country) country, comment);-
380 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTimeZone
else {
1
381 tz = QTimeZone(ianaId.toUtf8());-
382 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
2
383 return
executed 3 times by 2 tests: return ds;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
ds;
executed 3 times by 2 tests: return ds;
Executed by:
  • tst_QDateTime
  • tst_QTimeZone
3
384}-
385-
386-
387-
388QDebug operator<<(QDebug dbg, const QTimeZone &tz)-
389{-
390 QDebugStateSaver saver(dbg);-
391-
392 dbg.nospace() << "QTimeZone(" << QString::fromUtf8(tz.id()) << ')';-
393 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
394}-
395-
396-
397-
Switch to Source codePreprocessed file

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