summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtimezoneprivate.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-0/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/xml/htmlinfo/simpleexample.html examples/xml/rsslisting/rsslisting.cpp qmake/generators/win32/msbuild_objectmodel.cpp src/3rdparty/harfbuzz-ng/src/hb-private.hh src/corelib/global/qlogging.cpp src/corelib/io/qstorageinfo_unix.cpp src/corelib/thread/qwaitcondition_unix.cpp src/gui/kernel/qguiapplication.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp src/testlib/doc/src/qt-webpages.qdoc tests/auto/other/qaccessibility/tst_qaccessibility.cpp Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
| * Timezones: Fix handling of offset-from-UTC QTimeZonesThiago Macieira2015-02-231-0/+9
| | | | | | | | | | | | | | | | | | | | Those QTimeZones failed to convert to other timezones because the data() virtual function was never overridden and reimplemented. That meant all QUtcTimeZonePrivate objects were *really* UTC, with no offset. Task-number: QTBUG-44600 Change-Id: Ia0aac2f09e9245339951ffff13c5294bb783c674 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QTimeZone: don't use QSet, use sorted QListMarc Mutz2015-02-171-32/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSet, as a node-based container, requires one memory allocation per element inserted. QList, as a contiguous-memory container (at least in the case of a QByteArray payload), requires one memory allocation per container. The higher lookup speed might still speak for using QSet, but there are only two uses of the sets: 1. Checking for existence (or lack thereof) of timezone names. For this, first generating a container full of data just to check for existence of one item of data is extremely wasteful. The QTZPrivate API should be extended to allow said lookup to be performed on the native data store instead. That leaves 2. Returning a sorted(!) list(!) from the public QTimeZone API. There is no reason why, during the construction of those sorted lists, the data should be held in a set. Instead, the well-known technique of first cramming everything into a result container, which is subsequently sorted and has its duplicates removed, can be used here. Saves more than 8K of text size on AMD64 stripped release builds. Change-Id: I71c2298e94e02d55b0c9fb6f7ebeaed79a1fe2db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update copyright headersJani Heikkinen2015-02-111-6/+6
|/ | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Add missing #include <qdatastream.h> or <qiodevice.h>Thiago Macieira2014-08-071-0/+1
| | | | | | | Lots of code depended on an indirect includes from qstringlist.h. Change-Id: I33d0dce33d64302d6c0e49180cc1249b90ab27c5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QTimeZone: optimize QTimeZonePrivate::isValidId()Marc Mutz2014-07-311-18/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is used in the named timezone ctor and was using QByteArray::split(), followed by size checks and a linear scan for invalid chars per section. The use of split() resulted in a lot of memory allocations and, unsurprisingly, bad performance. The new code just performs one linear scan through the byte array, calculating section sizes on the fly. Benchmark results (with the test data in tst_QTimeZone::isValidId_data()) show typical speedups of ~10x for valid IDs: RESULT : tst_QTimeZone::isValidId_bench():"minimal middle": - 0.00036 msecs per iteration (total: 95, iterations: 262144) + 0.000035 msecs per iteration (total: 74, iterations: 2097152) Even in the sweet-spot case of the old code---a space character anywhere in the string, checked for before the split---the new code is anywhere between slightly faster and not much slower: RESULT : tst_QTimeZone::isValidId_bench():"invalid char ' ' front": - 0.000011 msecs per iteration (total: 94, iterations: 8388608) + 0.000010 msecs per iteration (total: 86, iterations: 8388608) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ' ' middle": - 0.000014 msecs per iteration (total: 62, iterations: 4194304) + 0.000016 msecs per iteration (total: 69, iterations: 4194304) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ' ' back": - 0.000018 msecs per iteration (total: 79, iterations: 4194304) + 0.000023 msecs per iteration (total: 98, iterations: 4194304) This is not surprising, as the space character was singled out for a fast-exit check before. For any other invalid character, the new version is anywhere from 15x to 35x faster: RESULT : tst_QTimeZone::isValidId_bench():"invalid char ? front": - 0.00034 msecs per iteration (total: 91, iterations: 262144) + 0.000010 msecs per iteration (total: 87, iterations: 8388608) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ? middle": - 0.00036 msecs per iteration (total: 96, iterations: 262144) + 0.000016 msecs per iteration (total: 68, iterations: 4194304) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ? back": - 0.00035 msecs per iteration (total: 94, iterations: 262144) + 0.000021 msecs per iteration (total: 92, iterations: 4194304) If there was a deeper reason to single out the space character, that fast-exit path can easily be restored. This function is often used in conjunction with availableTimeZoneIds(), which currently vastly dominates the runtime of the function calling both, but I'll add another optimization for the common use-case of just checking for a time-zone's existence in a subsequent commit. Change-Id: Ife1d096fcd39464083ea464c23e49ad98fabf345 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Reduce QtCoreLib size by not repeating "UTC" string too often.Jędrzej Nowacki2014-07-251-4/+4
| | | | | | | | It is a minor reduction, in release build it is ~200 bytes Change-Id: I4f7972c95769f2e0ca1ddc935ff7a0a6b4379e2a Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* QTimeZone - Change from Olson ID to IANA IDJohn Layt2014-01-111-24/+24
| | | | | | | | Complete changes from using Olsen/Olson in the code to IANA. Completes a change started in 5.2 release branch on the public occurrences. Change-Id: Ib077fcda2c77eef6f04ec28901d8d2d7210b8c72 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimeZone: Fix isValidId()John Layt2013-12-061-2/+4
| | | | | | | | | | Fix isValidId() which was failing valid IDs because it was splitting name parts by \ instead of /. it was also rejecting offset from UTC formats names. Add unit tests. Task-number: QTBUG-35025 Change-Id: I4d23d2e54f4a9fac9afcc4eff0a02d6f4af21385 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Repack structs with more than one padding holeThiago Macieira2013-12-031-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | Sizes gained (measured on 64-bit systems) BezierEase: shrunk 8 bytes QRegExpCharClass: shrunk 8 bytes QRegularExpressionPrivate: shrunk 8 bytes QTimeLinePrivate: shrunk 8 bytes QUtcTimeZonePrivate: shrunk 8 bytes QTextStreamPrivate: shrunk 8 bytes QDirPrivate: shrunk 8 bytes QFileDevicePrivate: shrunk 8 bytes Not done: QRegExpEngine: 18 bytes in 6 holes (you deserve high memory usage if you're still using QRegExp) QTextBoundaryFinder: 8 bytes in 2 holes (public class) QIODevicePrivate: 6 bytes in 2 holes, but there's no gain in packing QProcessPrivate: too complex and my copy is modified QThreadData: awaiting change from Marc Change-Id: I2a388b5ce17dec0dafcef18ed2e80d0379aa7d1e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimeZone - Fix dateForLocalTime() to check validity of next transitionJohn Layt2013-11-211-3/+6
| | | | | | | | | The private method dateForLocalTime() was not checking that transitions were valid, resulting in infinite looping when a time zone didn't have any future transitions. Change-Id: I0e5d07063861778dd86056a80c36fdd9f9d36133 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QTimeZone - Fix TZ file abbreviationsJohn Layt2013-11-211-2/+3
| | | | | | | | | | | | | | | | Fix parsing of TZ file abbreviations, to correctly return cases where POSIX rule doesn't have separate DST rules, and where abbreviation is a sub-string of another abbreviation, otherwise any toString() call will crash. Add test to exercise all available time zones, especially useful for TZ file to confirm all file format variations dealt with. Fix parsing of Version 3 of TZ file, and ICU display name, to allow all files generated from release 2013f to pass, otherwise isValid() call will crash. Task-number: QTBUG-34061 Change-Id: Ie0b6abc218adff1c8967eb33fdb0762041d2305f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimeZone - Change Olsen ID to IANA IDJohn Layt2013-11-211-6/+6
| | | | | | | | | | | | | | | The name Olson was misspelled as Olsen in the public api of QTimeZone which is needed to be fixed before first public release in 5.2 would freeze the api and prevent it being fixed. It has been decided that renaming as IANA ID would be more future-proof. Fixes to the private code will be done separately to keep this patch against release branch to the minimum required. Task-number: QTBUG-34735 Change-Id: I8ee90644862c907f6d1937b8536f0c02583ae736 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QDateTime - Add QTimeZone supportJohn Layt2013-09-231-0/+65
| | | | | | | | | | | Add support to QDateTime for time zones using the new QTimeZone class. [ChangeLog][QtCore][QDateTime] Add support for a new Qt::TimeZone spec to be used with QTimeZone to define times in a specific time zone. Change-Id: I21bfa52a8ba8989b55bb74e025d1f2b2b623b2a7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimeZone - Define new class and apiJohn Layt2013-09-221-0/+643
Implement the new QTimeZone class based on the Olsen Time Zone ID's. This is the base implementation and does not include the Platform backends which are implemented separately. This change does include a default UTC backed to be used if no Platform backend is available, i.e. if QT_NO_SYSTEMLOCALE is set and ICU is not configured. This backend also provides a default set of time zones in the standard "UTC+00:00" offset format that are guaranteed to always exist regardless of the Platform backend. This change includes conversion functions between the Olsen ID's and Windows ID's using a conversion table based on Unicode CLDR data. This is implemented for all platforms for scenarios such as a Linux program needing to communicate with a Windows Exchange Server using the Windows ID. The CLDR conversion table is included under the UNICODE license, see http://unicode.org/copyright.html for details. [ChangeLog][QtCore][QTimeZone] Added new QTimeZone class to support time tone calculations using the host platform time zone database and the Olsen time zone ID's. Change-Id: Ibb417d08cf2663a0979d2be855d2c6ad6ad01509 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>