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