| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qtimezoneprivate.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | enum { | - | ||||||||||||
| 8 | MSECS_TRAN_WINDOW = 21600000 | - | ||||||||||||
| 9 | }; | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | - | |||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | - | |||||||||||||
| 15 | static const int windowsDataTableSize = sizeof(windowsDataTable) / sizeof(QWindowsData) - 1; | - | ||||||||||||
| 16 | static const int zoneDataTableSize = sizeof(zoneDataTable) / sizeof(QZoneData) - 1; | - | ||||||||||||
| 17 | static const int utcDataTableSize = sizeof(utcDataTable) / sizeof(QUtcData) - 1; | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | - | |||||||||||||
| 20 | static 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: &zoneDataTable[index];return &zoneDataTable[index];Executed by:
executed 6186 times by 1 test: return &zoneDataTable[index];Executed by:
| 6186 | ||||||||||||
| 24 | } | - | ||||||||||||
| 25 | - | |||||||||||||
| 26 | static 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: &windowsDataTable[index];return &windowsDataTable[index];Executed by:
executed 842 times by 1 test: return &windowsDataTable[index];Executed by:
| 842 | ||||||||||||
| 30 | } | - | ||||||||||||
| 31 | - | |||||||||||||
| 32 | static 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: &utcDataTable[index];return &utcDataTable[index];Executed by:
executed 37617 times by 2 tests: return &utcDataTable[index];Executed by:
| 37617 | ||||||||||||
| 36 | } | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | - | |||||||||||||
| 39 | static QByteArray windowsId(const QWindowsData *windowsData) | - | ||||||||||||
| 40 | { | - | ||||||||||||
| 41 | return executed 554 times by 1 test: (windowsIdData + windowsData->windowsIdIndex);return (windowsIdData + windowsData->windowsIdIndex);Executed by:
executed 554 times by 1 test: return (windowsIdData + windowsData->windowsIdIndex);Executed by:
| 554 | ||||||||||||
| 42 | } | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | static QByteArray ianaId(const QWindowsData *windowsData) | - | ||||||||||||
| 46 | { | - | ||||||||||||
| 47 | return executed 1 time by 1 test: (ianaIdData + windowsData->ianaIdIndex);return (ianaIdData + windowsData->ianaIdIndex);Executed by:
executed 1 time by 1 test: return (ianaIdData + windowsData->ianaIdIndex);Executed by:
| 1 | ||||||||||||
| 48 | } | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | - | |||||||||||||
| 51 | static QByteArray ianaId(const QZoneData *zoneData) | - | ||||||||||||
| 52 | { | - | ||||||||||||
| 53 | return executed 1692 times by 1 test: (ianaIdData + zoneData->ianaIdIndex);return (ianaIdData + zoneData->ianaIdIndex);Executed by:
executed 1692 times by 1 test: return (ianaIdData + zoneData->ianaIdIndex);Executed by:
| 1692 | ||||||||||||
| 54 | } | - | ||||||||||||
| 55 | - | |||||||||||||
| 56 | static QByteArray utcId(const QUtcData *utcData) | - | ||||||||||||
| 57 | { | - | ||||||||||||
| 58 | return executed 37580 times by 2 tests: (ianaIdData + utcData->ianaIdIndex);return (ianaIdData + utcData->ianaIdIndex);Executed by:
executed 37580 times by 2 tests: return (ianaIdData + utcData->ianaIdIndex);Executed by:
| 37580 | ||||||||||||
| 59 | } | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | static quint16 toWindowsIdKey(const QByteArray &winId) | - | ||||||||||||
| 62 | { | - | ||||||||||||
| 63 | for (quint16 i = 0; i < windowsDataTableSize
| 3-552 | ||||||||||||
| 64 | const QWindowsData *data = windowsData(i); | - | ||||||||||||
| 65 | if (windowsId(data) == winId
| 9-543 | ||||||||||||
| 66 | return executed 9 times by 1 test: data->windowsIdKey;return data->windowsIdKey;Executed by:
executed 9 times by 1 test: return data->windowsIdKey;Executed by:
| 9 | ||||||||||||
| 67 | } executed 543 times by 1 test: end of blockExecuted by:
| 543 | ||||||||||||
| 68 | return executed 3 times by 1 test: 0;return 0;Executed by:
executed 3 times by 1 test: return 0;Executed by:
| 3 | ||||||||||||
| 69 | } | - | ||||||||||||
| 70 | - | |||||||||||||
| 71 | static QByteArray toWindowsIdLiteral(quint16 windowsIdKey) | - | ||||||||||||
| 72 | { | - | ||||||||||||
| 73 | for (quint16 i = 0; i < windowsDataTableSize
| 0-52 | ||||||||||||
| 74 | const QWindowsData *data = windowsData(i); | - | ||||||||||||
| 75 | if (data->windowsIdKey == windowsIdKey
| 2-50 | ||||||||||||
| 76 | return executed 2 times by 1 test: windowsId(data);return windowsId(data);Executed by:
executed 2 times by 1 test: return windowsId(data);Executed by:
| 2 | ||||||||||||
| 77 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||
| 78 | return never executed: QByteArray();return QByteArray();never executed: return QByteArray(); | 0 | ||||||||||||
| 79 | } | - | ||||||||||||
| 80 | - | |||||||||||||
| 81 | - | |||||||||||||
| 82 | - | |||||||||||||
| 83 | - | |||||||||||||
| 84 | - | |||||||||||||
| 85 | QTimeZonePrivate::QTimeZonePrivate() | - | ||||||||||||
| 86 | { | - | ||||||||||||
| 87 | } | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | QTimeZonePrivate::QTimeZonePrivate(const QTimeZonePrivate &other) | - | ||||||||||||
| 90 | : QSharedData(other), m_id(other.m_id) | - | ||||||||||||
| 91 | { | - | ||||||||||||
| 92 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||
| 93 | - | |||||||||||||
| 94 | QTimeZonePrivate::~QTimeZonePrivate() | - | ||||||||||||
| 95 | { | - | ||||||||||||
| 96 | } | - | ||||||||||||
| 97 | - | |||||||||||||
| 98 | QTimeZonePrivate *QTimeZonePrivate::clone() | - | ||||||||||||
| 99 | { | - | ||||||||||||
| 100 | return never executed: new QTimeZonePrivate(*this);return new QTimeZonePrivate(*this);never executed: return new QTimeZonePrivate(*this); | 0 | ||||||||||||
| 101 | } | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | bool QTimeZonePrivate::operator==(const QTimeZonePrivate &other) const | - | ||||||||||||
| 104 | { | - | ||||||||||||
| 105 | - | |||||||||||||
| 106 | - | |||||||||||||
| 107 | - | |||||||||||||
| 108 | return executed 21 times by 2 tests: (m_id == other.m_id);return (m_id == other.m_id);Executed by:
executed 21 times by 2 tests: return (m_id == other.m_id);Executed by:
| 21 | ||||||||||||
| 109 | } | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | bool QTimeZonePrivate::operator!=(const QTimeZonePrivate &other) const | - | ||||||||||||
| 112 | { | - | ||||||||||||
| 113 | return executed 2 times by 1 test: !(*this == other);return !(*this == other);Executed by:
executed 2 times by 1 test: return !(*this == other);Executed by:
| 2 | ||||||||||||
| 114 | } | - | ||||||||||||
| 115 | - | |||||||||||||
| 116 | bool QTimeZonePrivate::isValid() const | - | ||||||||||||
| 117 | { | - | ||||||||||||
| 118 | return executed 13410 times by 2 tests: !m_id.isEmpty();return !m_id.isEmpty();Executed by:
executed 13410 times by 2 tests: return !m_id.isEmpty();Executed by:
| 13410 | ||||||||||||
| 119 | } | - | ||||||||||||
| 120 | - | |||||||||||||
| 121 | QByteArray QTimeZonePrivate::id() const | - | ||||||||||||
| 122 | { | - | ||||||||||||
| 123 | return executed 470 times by 2 tests: m_id;return m_id;Executed by:
executed 470 times by 2 tests: return m_id;Executed by:
| 470 | ||||||||||||
| 124 | } | - | ||||||||||||
| 125 | - | |||||||||||||
| 126 | QLocale::Country QTimeZonePrivate::country() const | - | ||||||||||||
| 127 | { | - | ||||||||||||
| 128 | - | |||||||||||||
| 129 | for (int i = 0; i < zoneDataTableSize
| 0 | ||||||||||||
| 130 | const QZoneData *data = zoneData(i); | - | ||||||||||||
| 131 | if (ianaId(data).split(' ').contains(m_id)
| 0 | ||||||||||||
| 132 | return never executed: (QLocale::Country)data->country;return (QLocale::Country)data->country;never executed: return (QLocale::Country)data->country; | 0 | ||||||||||||
| 133 | } never executed: end of block | 0 | ||||||||||||
| 134 | return never executed: QLocale::AnyCountry;return QLocale::AnyCountry;never executed: return QLocale::AnyCountry; | 0 | ||||||||||||
| 135 | } | - | ||||||||||||
| 136 | - | |||||||||||||
| 137 | QString QTimeZonePrivate::comment() const | - | ||||||||||||
| 138 | { | - | ||||||||||||
| 139 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 140 | } | - | ||||||||||||
| 141 | - | |||||||||||||
| 142 | QString QTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch, | - | ||||||||||||
| 143 | QTimeZone::NameType nameType, | - | ||||||||||||
| 144 | const QLocale &locale) const | - | ||||||||||||
| 145 | { | - | ||||||||||||
| 146 | if (nameType == QTimeZone::OffsetName
| 0-451 | ||||||||||||
| 147 | return never executed: isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch));return isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch));never executed: return isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch)); | 0 | ||||||||||||
| 148 | - | |||||||||||||
| 149 | if (isDaylightTime(atMSecsSinceEpoch)
| 21-430 | ||||||||||||
| 150 | return executed 21 times by 1 test: displayName(QTimeZone::DaylightTime, nameType, locale);return displayName(QTimeZone::DaylightTime, nameType, locale);Executed by:
executed 21 times by 1 test: return displayName(QTimeZone::DaylightTime, nameType, locale);Executed by:
| 21 | ||||||||||||
| 151 | else | - | ||||||||||||
| 152 | return executed 430 times by 1 test: displayName(QTimeZone::StandardTime, nameType, locale);return displayName(QTimeZone::StandardTime, nameType, locale);Executed by:
executed 430 times by 1 test: return displayName(QTimeZone::StandardTime, nameType, locale);Executed by:
| 430 | ||||||||||||
| 153 | } | - | ||||||||||||
| 154 | - | |||||||||||||
| 155 | QString 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: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 163 | } | - | ||||||||||||
| 164 | - | |||||||||||||
| 165 | QString QTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 166 | { | - | ||||||||||||
| 167 | (void)atMSecsSinceEpoch; | - | ||||||||||||
| 168 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 169 | } | - | ||||||||||||
| 170 | - | |||||||||||||
| 171 | int QTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 172 | { | - | ||||||||||||
| 173 | return executed 45 times by 1 test: standardTimeOffset(atMSecsSinceEpoch) + daylightTimeOffset(atMSecsSinceEpoch);return standardTimeOffset(atMSecsSinceEpoch) + daylightTimeOffset(atMSecsSinceEpoch);Executed by:
executed 45 times by 1 test: return standardTimeOffset(atMSecsSinceEpoch) + daylightTimeOffset(atMSecsSinceEpoch);Executed by:
| 45 | ||||||||||||
| 174 | } | - | ||||||||||||
| 175 | - | |||||||||||||
| 176 | int QTimeZonePrivate::standardTimeOffset(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 177 | { | - | ||||||||||||
| 178 | (void)atMSecsSinceEpoch; | - | ||||||||||||
| 179 | return never executed: invalidSeconds();return invalidSeconds();never executed: return invalidSeconds(); | 0 | ||||||||||||
| 180 | } | - | ||||||||||||
| 181 | - | |||||||||||||
| 182 | int QTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 183 | { | - | ||||||||||||
| 184 | (void)atMSecsSinceEpoch; | - | ||||||||||||
| 185 | return never executed: invalidSeconds();return invalidSeconds();never executed: return invalidSeconds(); | 0 | ||||||||||||
| 186 | } | - | ||||||||||||
| 187 | - | |||||||||||||
| 188 | bool QTimeZonePrivate::hasDaylightTime() const | - | ||||||||||||
| 189 | { | - | ||||||||||||
| 190 | return executed 207 times by 2 tests: false;return false;Executed by:
executed 207 times by 2 tests: return false;Executed by:
| 207 | ||||||||||||
| 191 | } | - | ||||||||||||
| 192 | - | |||||||||||||
| 193 | bool QTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 194 | { | - | ||||||||||||
| 195 | (void)atMSecsSinceEpoch; | - | ||||||||||||
| 196 | return executed 41 times by 2 tests: false;return false;Executed by:
executed 41 times by 2 tests: return false;Executed by:
| 41 | ||||||||||||
| 197 | } | - | ||||||||||||
| 198 | - | |||||||||||||
| 199 | QTimeZonePrivate::Data QTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const | - | ||||||||||||
| 200 | { | - | ||||||||||||
| 201 | (void)forMSecsSinceEpoch; | - | ||||||||||||
| 202 | return never executed: invalidData();return invalidData();never executed: return invalidData(); | 0 | ||||||||||||
| 203 | } | - | ||||||||||||
| 204 | - | |||||||||||||
| 205 | - | |||||||||||||
| 206 | - | |||||||||||||
| 207 | QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) const | - | ||||||||||||
| 208 | { | - | ||||||||||||
| 209 | if (!hasDaylightTime()
| 0-646 | ||||||||||||
| 210 | - | |||||||||||||
| 211 | - | |||||||||||||
| 212 | return executed 347 times by 2 tests: data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));return data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));Executed by:
executed 347 times by 2 tests: return data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));Executed by:
| 347 | ||||||||||||
| 213 | } | - | ||||||||||||
| 214 | - | |||||||||||||
| 215 | - | |||||||||||||
| 216 | - | |||||||||||||
| 217 | Data tran = previousTransition(forLocalMSecs); | - | ||||||||||||
| 218 | Data nextTran; | - | ||||||||||||
| 219 | - | |||||||||||||
| 220 | - | |||||||||||||
| 221 | - | |||||||||||||
| 222 | if (forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)
| 5-641 | ||||||||||||
| 223 | while (tran.atMSecsSinceEpoch != invalidMSecs()
| 0-10 | ||||||||||||
| 224 | && forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)
| 5 | ||||||||||||
| 225 | nextTran = tran; | - | ||||||||||||
| 226 | tran = previousTransition(tran.atMSecsSinceEpoch); | - | ||||||||||||
| 227 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||
| 228 | } executed 5 times by 1 test: else {end of blockExecuted by:
| 5 | ||||||||||||
| 229 | - | |||||||||||||
| 230 | - | |||||||||||||
| 231 | nextTran = nextTransition(tran.atMSecsSinceEpoch); | - | ||||||||||||
| 232 | while (nextTran.atMSecsSinceEpoch != invalidMSecs()
| 249-6111 | ||||||||||||
| 233 | && forLocalMSecs >= nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)
| 392-5719 | ||||||||||||
| 234 | tran = nextTran; | - | ||||||||||||
| 235 | nextTran = nextTransition(tran.atMSecsSinceEpoch); | - | ||||||||||||
| 236 | } executed 5719 times by 2 tests: end of blockExecuted by:
| 5719 | ||||||||||||
| 237 | } executed 641 times by 2 tests: end of blockExecuted by:
| 641 | ||||||||||||
| 238 | - | |||||||||||||
| 239 | if (tran.daylightTimeOffset == 0
| 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
| 0-587 | ||||||||||||
| 247 | - | |||||||||||||
| 248 | - | |||||||||||||
| 249 | - | |||||||||||||
| 250 | - | |||||||||||||
| 251 | - | |||||||||||||
| 252 | Data dstTran = previousTransition(tran.atMSecsSinceEpoch); | - | ||||||||||||
| 253 | if (dstTran.atMSecsSinceEpoch != invalidMSecs()
| 0-15 | ||||||||||||
| 254 | && dstTran.daylightTimeOffset > 0
| 0-15 | ||||||||||||
| 255 | tran = dstTran; executed 12 times by 1 test: tran = dstTran;Executed by:
| 12 | ||||||||||||
| 256 | } executed 15 times by 1 test: else if (diffNextTran >= 0end of blockExecuted by:
| 0-572 | ||||||||||||
| 257 | - | |||||||||||||
| 258 | - | |||||||||||||
| 259 | tran = nextTran; | - | ||||||||||||
| 260 | forLocalMSecs = forLocalMSecs + (nextTran.daylightTimeOffset * 1000); | - | ||||||||||||
| 261 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 262 | } executed 587 times by 2 tests: end of blockExecuted by:
| 587 | ||||||||||||
| 263 | - | |||||||||||||
| 264 | - | |||||||||||||
| 265 | tran.atMSecsSinceEpoch = forLocalMSecs - (tran.offsetFromUtc * 1000); | - | ||||||||||||
| 266 | return executed 646 times by 2 tests: tran;return tran;Executed by:
executed 646 times by 2 tests: return tran;Executed by:
| 646 | ||||||||||||
| 267 | } | - | ||||||||||||
| 268 | - | |||||||||||||
| 269 | bool QTimeZonePrivate::hasTransitions() const | - | ||||||||||||
| 270 | { | - | ||||||||||||
| 271 | return executed 481 times by 1 test: false;return false;Executed by:
executed 481 times by 1 test: return false;Executed by:
| 481 | ||||||||||||
| 272 | } | - | ||||||||||||
| 273 | - | |||||||||||||
| 274 | QTimeZonePrivate::Data QTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const | - | ||||||||||||
| 275 | { | - | ||||||||||||
| 276 | (void)afterMSecsSinceEpoch; | - | ||||||||||||
| 277 | return never executed: invalidData();return invalidData();never executed: return invalidData(); | 0 | ||||||||||||
| 278 | } | - | ||||||||||||
| 279 | - | |||||||||||||
| 280 | QTimeZonePrivate::Data QTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const | - | ||||||||||||
| 281 | { | - | ||||||||||||
| 282 | (void)beforeMSecsSinceEpoch; | - | ||||||||||||
| 283 | return never executed: invalidData();return invalidData();never executed: return invalidData(); | 0 | ||||||||||||
| 284 | } | - | ||||||||||||
| 285 | - | |||||||||||||
| 286 | QTimeZonePrivate::DataList QTimeZonePrivate::transitions(qint64 fromMSecsSinceEpoch, | - | ||||||||||||
| 287 | qint64 toMSecsSinceEpoch) const | - | ||||||||||||
| 288 | { | - | ||||||||||||
| 289 | DataList list; | - | ||||||||||||
| 290 | if (toMSecsSinceEpoch >= fromMSecsSinceEpoch
| 0-2 | ||||||||||||
| 291 | - | |||||||||||||
| 292 | Data next = nextTransition(fromMSecsSinceEpoch - 1); | - | ||||||||||||
| 293 | while (next.atMSecsSinceEpoch != invalidMSecs()
| 0-6 | ||||||||||||
| 294 | && next.atMSecsSinceEpoch <= toMSecsSinceEpoch
| 2-4 | ||||||||||||
| 295 | list.append(next); | - | ||||||||||||
| 296 | next = nextTransition(next.atMSecsSinceEpoch); | - | ||||||||||||
| 297 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 298 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 299 | return executed 2 times by 1 test: list;return list;Executed by:
executed 2 times by 1 test: return list;Executed by:
| 2 | ||||||||||||
| 300 | } | - | ||||||||||||
| 301 | - | |||||||||||||
| 302 | QByteArray QTimeZonePrivate::systemTimeZoneId() const | - | ||||||||||||
| 303 | { | - | ||||||||||||
| 304 | return never executed: QByteArray();return QByteArray();never executed: return QByteArray(); | 0 | ||||||||||||
| 305 | } | - | ||||||||||||
| 306 | - | |||||||||||||
| 307 | QList<QByteArray> QTimeZonePrivate::availableTimeZoneIds() const | - | ||||||||||||
| 308 | { | - | ||||||||||||
| 309 | return never executed: QList<QByteArray>();return QList<QByteArray>();never executed: return QList<QByteArray>(); | 0 | ||||||||||||
| 310 | } | - | ||||||||||||
| 311 | - | |||||||||||||
| 312 | QList<QByteArray> QTimeZonePrivate::availableTimeZoneIds(QLocale::Country country) const | - | ||||||||||||
| 313 | { | - | ||||||||||||
| 314 | - | |||||||||||||
| 315 | QList<QByteArray> regions; | - | ||||||||||||
| 316 | - | |||||||||||||
| 317 | - | |||||||||||||
| 318 | for (int i = 0; i < zoneDataTableSize
| 0 | ||||||||||||
| 319 | if (zoneData(i)->country == country
| 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: result;return result;never executed: return result; | 0 | ||||||||||||
| 333 | } | - | ||||||||||||
| 334 | - | |||||||||||||
| 335 | QList<QByteArray> QTimeZonePrivate::availableTimeZoneIds(int offsetFromUtc) const | - | ||||||||||||
| 336 | { | - | ||||||||||||
| 337 | - | |||||||||||||
| 338 | QList<QByteArray> offsets; | - | ||||||||||||
| 339 | - | |||||||||||||
| 340 | for (int i = 0; i < windowsDataTableSize
| 1-106 | ||||||||||||
| 341 | const QWindowsData *winData = windowsData(i); | - | ||||||||||||
| 342 | if (winData->offsetFromUtc == offsetFromUtc
| 4-102 | ||||||||||||
| 343 | for (int j = 0; j < zoneDataTableSize
| 4-1376 | ||||||||||||
| 344 | const QZoneData *data = zoneData(j); | - | ||||||||||||
| 345 | if (data->windowsIdKey == winData->windowsIdKey
| 27-1349 | ||||||||||||
| 346 | offsets += ianaId(data).split(' '); executed 27 times by 1 test: offsets += ianaId(data).split(' ');Executed by:
| 27 | ||||||||||||
| 347 | } executed 1376 times by 1 test: end of blockExecuted by:
| 1376 | ||||||||||||
| 348 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 349 | } executed 106 times by 1 test: end of blockExecuted by:
| 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: result;return result;Executed by:
executed 1 time by 1 test: return result;Executed by:
| 1 | ||||||||||||
| 361 | } | - | ||||||||||||
| 362 | - | |||||||||||||
| 363 | - | |||||||||||||
| 364 | void QTimeZonePrivate::serialize(QDataStream &ds) const | - | ||||||||||||
| 365 | { | - | ||||||||||||
| 366 | ds << QString::fromUtf8(m_id); | - | ||||||||||||
| 367 | } executed 2 times by 2 tests: end of blockExecuted by:
| 2 | ||||||||||||
| 368 | - | |||||||||||||
| 369 | - | |||||||||||||
| 370 | - | |||||||||||||
| 371 | - | |||||||||||||
| 372 | QTimeZonePrivate::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: data;return data;Executed by:
executed 1890 times by 2 tests: return data;Executed by:
| 1890 | ||||||||||||
| 380 | } | - | ||||||||||||
| 381 | - | |||||||||||||
| 382 | QTimeZone::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: offsetData;return offsetData;Executed by:
executed 5080 times by 1 test: return offsetData;Executed by:
| 5080 | ||||||||||||
| 390 | } | - | ||||||||||||
| 391 | - | |||||||||||||
| 392 | QTimeZone::OffsetData QTimeZonePrivate::toOffsetData(const QTimeZonePrivate::Data &data) | - | ||||||||||||
| 393 | { | - | ||||||||||||
| 394 | QTimeZone::OffsetData offsetData = invalidOffsetData(); | - | ||||||||||||
| 395 | if (data.atMSecsSinceEpoch != invalidMSecs()
| 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 blockExecuted by:
| 3011 | ||||||||||||
| 402 | return executed 4637 times by 1 test: offsetData;return offsetData;Executed by:
executed 4637 times by 1 test: return offsetData;Executed by:
| 4637 | ||||||||||||
| 403 | } | - | ||||||||||||
| 404 | - | |||||||||||||
| 405 | - | |||||||||||||
| 406 | bool 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
| 518-7709 | ||||||||||||
| 412 | const char ch = *it; | - | ||||||||||||
| 413 | if (ch == '/'
| 578-7131 | ||||||||||||
| 414 | if (sectionLength < MinSectionLength
| 3-575 | ||||||||||||
| 415 | return executed 6 times by 1 test: false;return false;Executed by:
executed 6 times by 1 test: return false;Executed by:
| 6 | ||||||||||||
| 416 | sectionLength = -1; | - | ||||||||||||
| 417 | } executed 572 times by 1 test: else if (ch == '-'end of blockExecuted by:
| 30-7101 | ||||||||||||
| 418 | if (sectionLength == 0
| 4-26 | ||||||||||||
| 419 | return executed 4 times by 1 test: false;return false;Executed by:
executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||
| 420 | } executed 26 times by 1 test: else if (!(ch >= 'a'end of blockExecuted by:
| 0-5499 | ||||||||||||
| 421 | && !(ch >= 'A'
| 72-1143 | ||||||||||||
| 422 | && !(ch == '_')
| 68-463 | ||||||||||||
| 423 | && !(ch == '.')
| 5-458 | ||||||||||||
| 424 | - | |||||||||||||
| 425 | && !(ch >= '0'
| 52-404 | ||||||||||||
| 426 | && !(ch == '+')
| 25-81 | ||||||||||||
| 427 | && !(ch == ':')
| 39-42 | ||||||||||||
| 428 | return executed 39 times by 1 test: false;return false;Executed by:
executed 39 times by 1 test: return false;Executed by:
| 39 | ||||||||||||
| 429 | } | - | ||||||||||||
| 430 | } executed 7660 times by 1 test: end of blockExecuted by:
| 7660 | ||||||||||||
| 431 | if (sectionLength < MinSectionLength
| 1-517 | ||||||||||||
| 432 | return executed 4 times by 1 test: false;return false;Executed by:
executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||
| 433 | return executed 514 times by 1 test: true;return true;Executed by:
executed 514 times by 1 test: return true;Executed by:
| 514 | ||||||||||||
| 434 | } | - | ||||||||||||
| 435 | - | |||||||||||||
| 436 | QString QTimeZonePrivate::isoOffsetFormat(int offsetFromUtc) | - | ||||||||||||
| 437 | { | - | ||||||||||||
| 438 | const int mins = offsetFromUtc / 60; | - | ||||||||||||
| 439 | return executed 7 times by 2 tests: QString::fromUtf8("UTC%1%2:%3").arg(mins >= 0 ? QLatin1Char('+') : QLatin1Char('-'))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:
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:
| 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:
| 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:
| 7 | ||||||||||||
| 442 | } | - | ||||||||||||
| 443 | - | |||||||||||||
| 444 | QByteArray QTimeZonePrivate::ianaIdToWindowsId(const QByteArray &id) | - | ||||||||||||
| 445 | { | - | ||||||||||||
| 446 | for (int i = 0; i < zoneDataTableSize
| 3-1655 | ||||||||||||
| 447 | const QZoneData *data = zoneData(i); | - | ||||||||||||
| 448 | if (ianaId(data).split(' ').contains(id)
| 2-1653 | ||||||||||||
| 449 | return executed 2 times by 1 test: toWindowsIdLiteral(data->windowsIdKey);return toWindowsIdLiteral(data->windowsIdKey);Executed by:
executed 2 times by 1 test: return toWindowsIdLiteral(data->windowsIdKey);Executed by:
| 2 | ||||||||||||
| 450 | } executed 1653 times by 1 test: end of blockExecuted by:
| 1653 | ||||||||||||
| 451 | return executed 3 times by 1 test: QByteArray();return QByteArray();Executed by:
executed 3 times by 1 test: return QByteArray();Executed by:
| 3 | ||||||||||||
| 452 | } | - | ||||||||||||
| 453 | - | |||||||||||||
| 454 | QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId) | - | ||||||||||||
| 455 | { | - | ||||||||||||
| 456 | const quint16 windowsIdKey = toWindowsIdKey(windowsId); | - | ||||||||||||
| 457 | for (int i = 0; i < windowsDataTableSize
| 1-132 | ||||||||||||
| 458 | const QWindowsData *data = windowsData(i); | - | ||||||||||||
| 459 | if (data->windowsIdKey == windowsIdKey
| 1-131 | ||||||||||||
| 460 | return executed 1 time by 1 test: ianaId(data);return ianaId(data);Executed by:
executed 1 time by 1 test: return ianaId(data);Executed by:
| 1 | ||||||||||||
| 461 | } executed 131 times by 1 test: end of blockExecuted by:
| 131 | ||||||||||||
| 462 | return executed 1 time by 1 test: QByteArray();return QByteArray();Executed by:
executed 1 time by 1 test: return QByteArray();Executed by:
| 1 | ||||||||||||
| 463 | } | - | ||||||||||||
| 464 | - | |||||||||||||
| 465 | QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId, | - | ||||||||||||
| 466 | QLocale::Country country) | - | ||||||||||||
| 467 | { | - | ||||||||||||
| 468 | const QList<QByteArray> list = windowsIdToIanaIds(windowsId, country); | - | ||||||||||||
| 469 | if (list.count() > 0
| 0-2 | ||||||||||||
| 470 | return executed 2 times by 1 test: list.first();return list.first();Executed by:
executed 2 times by 1 test: return list.first();Executed by:
| 2 | ||||||||||||
| 471 | else | - | ||||||||||||
| 472 | return never executed: QByteArray();return QByteArray();never executed: return QByteArray(); | 0 | ||||||||||||
| 473 | } | - | ||||||||||||
| 474 | - | |||||||||||||
| 475 | QList<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
| 2-688 | ||||||||||||
| 481 | const QZoneData *data = zoneData(i); | - | ||||||||||||
| 482 | if (data->windowsIdKey == windowsIdKey
| 4-684 | ||||||||||||
| 483 | list << ianaId(data).split(' '); executed 4 times by 1 test: list << ianaId(data).split(' ');Executed by:
| 4 | ||||||||||||
| 484 | } executed 688 times by 1 test: end of blockExecuted by:
| 688 | ||||||||||||
| 485 | - | |||||||||||||
| 486 | - | |||||||||||||
| 487 | std::sort(list.begin(), list.end()); | - | ||||||||||||
| 488 | return executed 2 times by 1 test: list;return list;Executed by:
executed 2 times by 1 test: return list;Executed by:
| 2 | ||||||||||||
| 489 | } | - | ||||||||||||
| 490 | - | |||||||||||||
| 491 | QList<QByteArray> QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId, | - | ||||||||||||
| 492 | QLocale::Country country) | - | ||||||||||||
| 493 | { | - | ||||||||||||
| 494 | const quint16 windowsIdKey = toWindowsIdKey(windowsId); | - | ||||||||||||
| 495 | for (int i = 0; i < zoneDataTableSize
| 2-2467 | ||||||||||||
| 496 | const QZoneData *data = zoneData(i); | - | ||||||||||||
| 497 | - | |||||||||||||
| 498 | if (data->windowsIdKey == windowsIdKey
| 6-2450 | ||||||||||||
| 499 | return executed 6 times by 1 test: ianaId(data).split(' ');return ianaId(data).split(' ');Executed by:
executed 6 times by 1 test: return ianaId(data).split(' ');Executed by:
| 6 | ||||||||||||
| 500 | } executed 2461 times by 1 test: end of blockExecuted by:
| 2461 | ||||||||||||
| 501 | - | |||||||||||||
| 502 | return executed 2 times by 1 test: QList<QByteArray>();return QList<QByteArray>();Executed by:
executed 2 times by 1 test: return QList<QByteArray>();Executed by:
| 2 | ||||||||||||
| 503 | } | - | ||||||||||||
| 504 | - | |||||||||||||
| 505 | - | |||||||||||||
| 506 | template<> QTimeZonePrivate *QSharedDataPointer<QTimeZonePrivate>::clone() | - | ||||||||||||
| 507 | { | - | ||||||||||||
| 508 | return executed 20 times by 1 test: d->clone();return d->clone();Executed by:
executed 20 times by 1 test: return d->clone();Executed by:
| 20 | ||||||||||||
| 509 | } | - | ||||||||||||
| 510 | - | |||||||||||||
| 511 | - | |||||||||||||
| 512 | - | |||||||||||||
| 513 | - | |||||||||||||
| 514 | - | |||||||||||||
| 515 | - | |||||||||||||
| 516 | - | |||||||||||||
| 517 | QUtcTimeZonePrivate::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 blockExecuted by:
| 470 | ||||||||||||
| 522 | - | |||||||||||||
| 523 | - | |||||||||||||
| 524 | QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QByteArray &id) | - | ||||||||||||
| 525 | { | - | ||||||||||||
| 526 | - | |||||||||||||
| 527 | for (int i = 0; i < utcDataTableSize
| 450-18897 | ||||||||||||
| 528 | const QUtcData *data = utcData(i); | - | ||||||||||||
| 529 | const QByteArray uid = utcId(data); | - | ||||||||||||
| 530 | if (uid == id
| 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:
| 46 | ||||||||||||
| 534 | } | - | ||||||||||||
| 535 | } executed 18851 times by 2 tests: end of blockExecuted by:
| 18851 | ||||||||||||
| 536 | } executed 496 times by 2 tests: end of blockExecuted by:
| 496 | ||||||||||||
| 537 | - | |||||||||||||
| 538 | - | |||||||||||||
| 539 | QUtcTimeZonePrivate::QUtcTimeZonePrivate(qint32 offsetSeconds) | - | ||||||||||||
| 540 | { | - | ||||||||||||
| 541 | QString utcId; | - | ||||||||||||
| 542 | - | |||||||||||||
| 543 | if (offsetSeconds == 0
| 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:
| 7 | ||||||||||||
| 547 | - | |||||||||||||
| 548 | init(utcId.toUtf8(), offsetSeconds, utcId, utcId, QLocale::AnyCountry, utcId); | - | ||||||||||||
| 549 | } executed 7 times by 2 tests: end of blockExecuted by:
| 7 | ||||||||||||
| 550 | - | |||||||||||||
| 551 | QUtcTimeZonePrivate::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 blockExecuted by:
| 3 | ||||||||||||
| 557 | - | |||||||||||||
| 558 | QUtcTimeZonePrivate::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 | - | |||||||||||||
| 567 | QUtcTimeZonePrivate::~QUtcTimeZonePrivate() | - | ||||||||||||
| 568 | { | - | ||||||||||||
| 569 | } | - | ||||||||||||
| 570 | - | |||||||||||||
| 571 | QTimeZonePrivate *QUtcTimeZonePrivate::clone() | - | ||||||||||||
| 572 | { | - | ||||||||||||
| 573 | return never executed: new QUtcTimeZonePrivate(*this);return new QUtcTimeZonePrivate(*this);never executed: return new QUtcTimeZonePrivate(*this); | 0 | ||||||||||||
| 574 | } | - | ||||||||||||
| 575 | - | |||||||||||||
| 576 | QTimeZonePrivate::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: d;return d;Executed by:
executed 85 times by 2 tests: return d;Executed by:
| 85 | ||||||||||||
| 584 | } | - | ||||||||||||
| 585 | - | |||||||||||||
| 586 | void QUtcTimeZonePrivate::init(const QByteArray &zoneId) | - | ||||||||||||
| 587 | { | - | ||||||||||||
| 588 | m_id = zoneId; | - | ||||||||||||
| 589 | } never executed: end of block | 0 | ||||||||||||
| 590 | - | |||||||||||||
| 591 | void 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 blockExecuted by:
| 526 | ||||||||||||
| 602 | - | |||||||||||||
| 603 | QLocale::Country QUtcTimeZonePrivate::country() const | - | ||||||||||||
| 604 | { | - | ||||||||||||
| 605 | return executed 43 times by 1 test: m_country;return m_country;Executed by:
executed 43 times by 1 test: return m_country;Executed by:
| 43 | ||||||||||||
| 606 | } | - | ||||||||||||
| 607 | - | |||||||||||||
| 608 | QString QUtcTimeZonePrivate::comment() const | - | ||||||||||||
| 609 | { | - | ||||||||||||
| 610 | return executed 42 times by 1 test: m_comment;return m_comment;Executed by:
executed 42 times by 1 test: return m_comment;Executed by:
| 42 | ||||||||||||
| 611 | } | - | ||||||||||||
| 612 | - | |||||||||||||
| 613 | QString 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
| 0-124 | ||||||||||||
| 620 | return never executed: m_abbreviation;return m_abbreviation;never executed: return m_abbreviation; | 0 | ||||||||||||
| 621 | else if (nameType == QTimeZone::OffsetName
| 0-124 | ||||||||||||
| 622 | return never executed: isoOffsetFormat(m_offsetFromUtc);return isoOffsetFormat(m_offsetFromUtc);never executed: return isoOffsetFormat(m_offsetFromUtc); | 0 | ||||||||||||
| 623 | return executed 124 times by 1 test: m_name;return m_name;Executed by:
executed 124 times by 1 test: return m_name;Executed by:
| 124 | ||||||||||||
| 624 | } | - | ||||||||||||
| 625 | - | |||||||||||||
| 626 | QString QUtcTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 627 | { | - | ||||||||||||
| 628 | (void)atMSecsSinceEpoch; | - | ||||||||||||
| 629 | return executed 83 times by 1 test: m_abbreviation;return m_abbreviation;Executed by:
executed 83 times by 1 test: return m_abbreviation;Executed by:
| 83 | ||||||||||||
| 630 | } | - | ||||||||||||
| 631 | - | |||||||||||||
| 632 | qint32 QUtcTimeZonePrivate::standardTimeOffset(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 633 | { | - | ||||||||||||
| 634 | (void)atMSecsSinceEpoch; | - | ||||||||||||
| 635 | return executed 172 times by 2 tests: m_offsetFromUtc;return m_offsetFromUtc;Executed by:
executed 172 times by 2 tests: return m_offsetFromUtc;Executed by:
| 172 | ||||||||||||
| 636 | } | - | ||||||||||||
| 637 | - | |||||||||||||
| 638 | qint32 QUtcTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const | - | ||||||||||||
| 639 | { | - | ||||||||||||
| 640 | (void)atMSecsSinceEpoch; | - | ||||||||||||
| 641 | return executed 46 times by 1 test: 0;return 0;Executed by:
executed 46 times by 1 test: return 0;Executed by:
| 46 | ||||||||||||
| 642 | } | - | ||||||||||||
| 643 | - | |||||||||||||
| 644 | QByteArray QUtcTimeZonePrivate::systemTimeZoneId() const | - | ||||||||||||
| 645 | { | - | ||||||||||||
| 646 | return never executed: utcQByteArray();return utcQByteArray();never executed: return utcQByteArray(); | 0 | ||||||||||||
| 647 | } | - | ||||||||||||
| 648 | - | |||||||||||||
| 649 | QList<QByteArray> QUtcTimeZonePrivate::availableTimeZoneIds() const | - | ||||||||||||
| 650 | { | - | ||||||||||||
| 651 | QList<QByteArray> result; | - | ||||||||||||
| 652 | result.reserve(utcDataTableSize); | - | ||||||||||||
| 653 | for (int i = 0; i < utcDataTableSize
| 467-18680 | ||||||||||||
| 654 | result << utcId(utcData(i)); executed 18680 times by 1 test: result << utcId(utcData(i));Executed by:
| 18680 | ||||||||||||
| 655 | std::sort(result.begin(), result.end()); | - | ||||||||||||
| 656 | - | |||||||||||||
| 657 | return executed 467 times by 1 test: result;return result;Executed by:
executed 467 times by 1 test: return result;Executed by:
| 467 | ||||||||||||
| 658 | } | - | ||||||||||||
| 659 | - | |||||||||||||
| 660 | QList<QByteArray> QUtcTimeZonePrivate::availableTimeZoneIds(QLocale::Country country) const | - | ||||||||||||
| 661 | { | - | ||||||||||||
| 662 | - | |||||||||||||
| 663 | if (country == QLocale::AnyCountry
| 0-1 | ||||||||||||
| 664 | return never executed: availableTimeZoneIds();return availableTimeZoneIds();never executed: return availableTimeZoneIds(); | 0 | ||||||||||||
| 665 | return executed 1 time by 1 test: QList<QByteArray>();return QList<QByteArray>();Executed by:
executed 1 time by 1 test: return QList<QByteArray>();Executed by:
| 1 | ||||||||||||
| 666 | } | - | ||||||||||||
| 667 | - | |||||||||||||
| 668 | QList<QByteArray> QUtcTimeZonePrivate::availableTimeZoneIds(qint32 offsetSeconds) const | - | ||||||||||||
| 669 | { | - | ||||||||||||
| 670 | QList<QByteArray> result; | - | ||||||||||||
| 671 | for (int i = 0; i < utcDataTableSize
| 1-40 | ||||||||||||
| 672 | const QUtcData *data = utcData(i); | - | ||||||||||||
| 673 | if (data->offsetFromUtc == offsetSeconds
| 3-37 | ||||||||||||
| 674 | result << utcId(data); executed 3 times by 1 test: result << utcId(data);Executed by:
| 3 | ||||||||||||
| 675 | } executed 40 times by 1 test: end of blockExecuted by:
| 40 | ||||||||||||
| 676 | std::sort(result.begin(), result.end()); | - | ||||||||||||
| 677 | - | |||||||||||||
| 678 | return executed 1 time by 1 test: result;return result;Executed by:
executed 1 time by 1 test: return result;Executed by:
| 1 | ||||||||||||
| 679 | } | - | ||||||||||||
| 680 | - | |||||||||||||
| 681 | - | |||||||||||||
| 682 | void 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: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 1 time by 1 test: }()) << QString::fromUtf8(m_id) << m_offsetFromUtc << m_namereturn qstring_literal_temp;Executed by:
| 1 | ||||||||||||
| 685 | << m_abbreviation << (qint32) m_country << m_comment; | - | ||||||||||||
| 686 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 687 | - | |||||||||||||
| 688 | - | |||||||||||||
| 689 | - | |||||||||||||
| Switch to Source code | Preprocessed file |