summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qdatetime
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * QDateTime: Ensure a valid timezone when using the "offset constructor".Christian Kandeler2015-09-231-0/+1
| | | | | | | | | | | | | | | | The timeZone() function used to assert when called on such an object (or, for a release build, return an invalid time zone). Change-Id: I6ae8316b2ad76f1f868e2498f7ce8aa3fcabf4a6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add shared implementation of a NSAutoreleasePool wrapper to qglobalTor Arne Vestbø2015-05-271-4/+2
|/ | | | | | | | | | | We have at least 5 different (but equal) implementations of a wrapper in Qt, and some code uses explicit NSAutoreleasePools. Having a shared implementation lets us clean up things a bit and makes it easier to reason about which pools are actually needed. Change-Id: I2fd8eefc3ae7308595ef9899b7820206268362a5 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* tst_QDateTime: remove silly test for timezone date too earlyThiago Macieira2015-03-111-7/+5
| | | | | | | | | | Let's not try to to compare our QTimeZone handling with the system one. Our handling goes beyond the range of the POSIX APIs, so that's a recipe for error. Change-Id: Iee8cbc07c4434ce9b560ffff13ca4a4f335bdbae Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* tst_QDateTime: Mark more Windows incorrect transitionsThiago Macieira2015-03-111-0/+12
| | | | | | | | | | | | | | The refactoring from a8c74ddcf78604c9038ba2a2bea81e445e4b3c58 commit exposed more issues in the Windows API. There were already quite a few QEXPECT_FAIL for this, so this isn't new. For example, localtime(1351386000) on the Central European Timezone should be "Sun Oct 28 02:00:00 CET 2012" (the second occurrence of 2 am), but the Windows API returns tm_isdst = 1 (i.e., still in the CEST timezone) and that's incorrect. Change-Id: I1bc63ac99b1d67b55d783f9606e5c59b24223b13 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* Fix regression in time zone handlingFrederik Gladhorn2015-03-111-12/+0
| | | | | | | | | | | | In QtScript we use the msecs since epoch conversion (JS date is based on the concept). After a8c74ddcf78604c9038ba2a2bea81e445e4b3c58 the date conversion test in qtscript started to fail. Instead of relying on the code working by chance, simply update the date when setting it with setMSecsSinceEpoch. Task-number: QTBUG-44885 Change-Id: I9f95c9cdccea52e7d1f808f3cb9e18570ef0df13 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix race condition in QDateTime::timeZone() and other methodsThiago Macieira2015-03-071-0/+53
| | | | | | | | | | | | | | | | | | | | When timezone support for QDateTime was added, we decided it was a good idea to delay creating the QTimeZone object and checking that the time is valid in that timezone (including for local time) until the user requested that information. Unfortunately, QExplicitlySharedDataPointer returns a non-const T* in operator->(), which meant we were accidentally modifying the d pointer's contents in const methods, which in turn means those const methods were not thread-safe when operating on the same object. This commit changes the d pointer to QSharedDataPointer, which is safer in this regard and pointed out where the issues with constness were located. Since we can't lazily calculate QTimeZone anymore, we need to do it whenever the date, time or offset changes. Task-number: QTBUG-43703 Change-Id: Ic5d393bfd36e48a193fcffff13b9686ef4ef1454 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-0/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+12
| | | | | | | | | | | | | | | | | | | | 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>
* | Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | | | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-112-29/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-211-0/+8
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
| * [QDateTime] ISO Time zone designators can be [+-]HHIsrael Lins2014-12-301-0/+8
| | | | | | | | | | | | | | | | | | Added support on QDateTime::fromString to read correctly dates on ISO format with Time zone designators at format [+-]HH Change-Id: Ied5c3b7950aee3d0879af0e05398081395c18df5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* | Add Objective-C specific type converters to QDateTimeJake Petroules2014-10-073-0/+99
|/ | | | | | | | | | | | | This patch adds the Objective-C NSDate/CDateRef converters to QDateTime [ChangeLog][QtCore][Objective-C] Added NSDate/CDateRef converters for QDateTime Task-number: QTBUG-37116 Change-Id: I937ea927083a2767b5b17f10a48bf453c9ff8b01 Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QNX: Make QDateTime "daylightTransitions" auto test passBernd Weimer2014-05-141-7/+7
| | | | | Change-Id: I8c68d15806c6ec39e98dddda86823d9b4e3a3169 Reviewed-by: John Layt <jlayt@kde.org>
* QDateTime: Add more tests for parsing/writing timezone offsetsDaniel Seither2014-05-081-0/+8
| | | | | | | | | The tests for toString/fromString previously didn't run tests for timezones with hh:mm where mm != 00. Change-Id: I74da99c5b6890f46ce06446084a8129b4cbc7a02 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: John Layt <jlayt@kde.org>
* Fix QDateTime auto testBernd Weimer2014-02-141-1/+2
| | | | | | | | Conversion from UTC to local time will result in same datetime value, if local time is in UTC. Change-Id: Icd4ea57cb46cc97bcc8fce4f4e579bf64a4d4b10 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-201-0/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qstring.cpp src/gui/image/image.pri src/gui/image/qimage.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/qeglfshooks_stub.cpp tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp Change-Id: I3b9ba029c8f2263b011f204fdf68c3231c6d4ce5
| * QDateTime - Fix isValid() if invalid QTimeZoneJohn Layt2014-01-111-0/+7
| | | | | | | | | | | | | | Explicitly check that the QTimeZone is valid before trying to use it. Change-Id: Iec415a2cb07071502fe71ee5ac92a7657e818f99 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-101-2/+42
|\| | | | | | | Change-Id: I99af0bef7f1c931533a324ebcfb27c40ee871a5e
| * Autotest: Fix QDateTime failure if the test got run West of GreenwichThiago Macieira2014-01-091-2/+42
| | | | | | | | | | | | | | | | | | | | | | | | There was a comment about the test failing for max() because of an overflow. That happens if you're at UTC or ahead of it (to the East of the Prime Meridian), which is how this test usually gets run (UTC, Europe/Oslo, Europe/Helsinki, Pacific/Auckland). But if you're behind UTC (to the West of the Prime Meridian), then the overflow happens for min(). Change-Id: Iebba49d1303e9f18f5038f5cf23c77bf83e5fd4b Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-11-261-1/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
| * QTimeZone - Fix dateForLocalTime() to check validity of next transitionJohn Layt2013-11-211-0/+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>
| * remove qt_windows.h include from qwineventnotifier.hJoerg Bornemann2013-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | We must not include qt_windows.h in public headers, otherwise we're cluttering the environment with a colorful bouquet of Windows API preprocessor macros and typedefs. Task-number: QTBUG-34058 Change-Id: I415717ea2a47f39e7f4b7ce1c1df9d49afc99278 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-10-241-0/+25
|\| | | | | | | Change-Id: Ie56539b2e0be611a363b5f15ae5412a78d6945a2
| * QDateTime - Fix RFC 2822 Date FormattingJohn Layt2013-10-171-0/+4
| | | | | | | | | | | | | | | | | | The RFC 2822 date format should always use en_US locale for month and day names instead of whatever the system locale is. Also remove some duplicate code. Change-Id: Ia2f7ee405b4e0e2f04980301783b9488628da73f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QDateTime - Fix toTimeSpec() for invalid datetimesJohn Layt2013-10-161-0/+21
| | | | | | | | | | | | | | | | | | | | Check if the datetime is valid before converting it to a different time spec. If it is invalid then just change the spec to keep behavior consistent with 5.1. Task-number: QTBUG-34020 Change-Id: I6630ec1d50f810a2178ab3222bd32af018085f81 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-10-041-24/+6
|\| | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/minimal/qminimalintegration.cpp src/plugins/platforms/offscreen/qoffscreenintegration.cpp Change-Id: Ica85deeab5c5038ac004718e25194b1157343480
| * QDateTime - Fix round-trip of second occurrence timesJohn Layt2013-09-271-24/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the Daylight Tme to Standard Time transition, the local time repeats itself, i.e. 2am occurs twice. Qt's behavior when setting this using the local time is ambiguous, as it depends on the system implementation of mktime, which behaves differently on different platforms. Currently this behavior remains undefined. When setting using an msecs or time_t value however we can determine the correct instance to use and cache it to ensure that any conversion back from local time to msecs is performed consistantly on all platforms. Note that caching this value will result in any calculations being wrong should the system time zone change, or its rules change. This will be fixed in Qt 5.3 when the system time zone change signal is implemented and QDateTime switches to using QTimeZone instead of mktime to provide consistnt behavior across platforms. The QTimeZone spec does not require this fix as it already caches the correct offset in setMSecsFromEpoch(). Change-Id: I799588db474e744a6d81e80f6a0442920569ebd3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | WinRT: Fix various test compilationsAndrew Knight2013-10-021-1/+4
|/ | | | | | | | | | | | | - Remove irrelevant test subdirs via .pro files - Follow WinCE codepaths where applicable - Replace unsupported Win32 APIs with WinRT equivalents This does not aim to fix any failures in the tests themselves; it only makes them compile. Change-Id: Ia82bc0cc402891f8f6238d4c261ee9152b51be80 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QDateTime - Add QTimeZone supportJohn Layt2013-09-231-0/+200
| | | | | | | | | | | 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>
* QDateTime - Add api for isDaylightTime()John Layt2013-09-201-0/+23
| | | | | | | | | | Add new method to return if the current time is Daylight Time. [ChangeLog][QtCore][QDateTime] Added new method isDaylightTime() to return if the datetime is in Daylight Time or not. Change-Id: Icb93fd5dd0b2f7d83d2d4643eeb12922c1137e3e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime - Fix Daylight Transition for "missing" hourJohn Layt2013-09-201-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Daylight Time transtion goes from Standard Time to Daylight Time there is a "missing" hour, i.e. at 2am CET the clock goes forward to 3am. Currently QDateTime ignores this gap and considers the time to be valid and able to be manipulated. This change respects the transition, so any time set in the missing hour is considered invalid, and any date maths returns valid results. The validity in the current time zone needs to be checked every time isValid() is called in case the system time zone has changed since the last time it was checked. This is done by calling mktime to check the returned result matches the expected result. This could be very inefficient, but the returned offset value is cached each time so mktime is not required to be called again within each method call, effectively meaning mktime is called the same number of times by each method. Note that this means any new methods added must be careful to ensure either isValid() or refreshLocalTime() is called first by any method needing to use the UTC value. [ChangeLog][QtCore][QDateTime] The Standard Time to Daylight Time transition for Qt::LocalTime is now handled correctly. Any date set in the "missing" hour is now considered invalid. All date math results that fall into the missing hour will be automatically adjusted to a valid time in the following hour. Change-Id: Ia652c8511b45df15f4917acf12403ec01a7f08e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime - Change date/time storage to msecsJohn Layt2013-09-201-34/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change from storing the date and time as QDate and QTime to a serialised msecs format. This format is a direct translation of the QDate and QTime values, it is not the actual msecs since the Unix epoch. This msecs format ensures we are always able to recreate the original QDate and QTime values, but should still simplify the code and improve performance. Because we no longer store the explicit date and time we need to store their isNull()/isValid() status separately. The changes in storage results in the same memory footprint as before. Note that this change does not optimize the code nor set out to fix the known bugs, it only seeks to maintain the current behavior, although some bugs are fixed implicitly. More bug fixes and optimizations will follow. [ChangeLog][Important Behavior Changes] The supported date range in QDateTime has been reduced to about +/- 292 million years, the range supported by the number of msecs since the Unix epoch of 1 Jan 1970 as stored in a qint64, and as able to be used in the setMSecsSinceEpoch() and toMSecsSinceEpoch() methods. Change-Id: I98804d8781909555d3313a3a7080eb8e70cb46ad Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert 15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c.Mitch Curtis2013-09-191-12/+9
| | | | | | | | | | It apparently breaks users' applications. Task-number: QTBUG-33487 Change-Id: Iaeceb3a02b5c7b9ab839c14693aaffcdf9394bc6 Reviewed-by: John Layt <jlayt@kde.org> Reviewed-by: hjk <hjk121@nokiamail.com>
* QDateTime - Switch to using msecs based functionsJohn Layt2013-09-141-14/+13
| | | | | | | | | | | | | | | | | | | | | | A number of QDateTime functions directly use or modify the data stored in the private, but future changes to store msecs and status make this maintenance more complicated. Where possible simplify this code to use the standard msecs functions, standard constructors, or public api instead. This greatly simplifies the functions and the following msecs storage code changes. This is an intermim step towards storing the time in msecs. Some functions will be slower as a result of this change, optimization will take place after all the msecs changes are completed. Note this also removes a test that used valid QDates outside the range of msecs, this change in behavior will be documented in the final mscs change. Change-Id: I6ef710f24babc7024091010064082e9be0b5bbfe Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime - Add test case for Daylight Time TransitionsJohn Layt2013-09-141-0/+377
| | | | | | | | | | Test the Daylight Time transitions. QDateTime does not correctly deal with many of these scenarios so those tests are marked as QEXPECTFAIL. These bugs will be progressively addressed in coming commits. Change-Id: I01eba9d6143a792f081542cb198e221efcf28e98 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QDateTime - Clean up Qt::DateFormat formatting and parsingJohn Layt2013-09-061-6/+66
| | | | | | | | | | | | | | | | Clean-up the implementation of toString() and fromString() methods in QDate, QTime and QDateTime code to be more consistent in ISODate and TextDate behavior, especially when handling TimeSpec. Reformat some code so all methods are consistent in appearance and function to make maintenance easier. This changes some corner-case behavior in TextDate and ISODate, but this either fixes bugs or makes the behavior match the documentation. Change-Id: I457aa1d7cd4f448cd9f8a2e80ec635f3cb98e58c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QDateTime - Switch to using the QLocale date formatterJohn Layt2013-09-051-57/+7
| | | | | | | | | | Switch the implementation of toString() methods in QDate, QTime and QDateTime to use the QLocale formatter, and remove the now redundant QDateTime formatter. Change-Id: Ie4f17c8a6e31acde3ce066f19835bb2b83351ce8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QDateTime - Add api for Time Zone AbbreviationJohn Layt2013-09-031-1/+32
| | | | | | | | | | | | | | | | | Add a new method to return the time zone abbreviation for the current time spec. For LocalTime this is the abbreviation returned by mktime. This new method will later be used in changes to the date formatter and QTimeZone. Note this change does not implement WinCE support. [ChangeLog][QtCore][QDateTime] Add method timeZoneAbbreviation() to return effective time zone abbreviation. Change-Id: I265a5e96c72eb7236974f80f053f1fb341e3c816 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QDateTime - Extend fromMSecsSinceEpoch APIJohn Layt2013-08-291-7/+29
| | | | | | | | | | | | | | | | | | | | | Add convenience methods for fromMSecsSinceEpoch() and fromTime_t() to enable direct creation of other time specs than LocalTime without the overhead of unncessary conversions. For example instead of: QDateTime dt = fromMSecsSinceEpoch(12345).toUtc(); the following saves two conversions: QDateTime dt = fromMSecsSinceEpoch(12345, Qt:UTC); This will improve the performance of the new QTimeZone class. [ChangeLog][QtCore][QDateTime] Added convenience methods for fromMSecsSinceEpoch() and fromTime_t() to take time spec to be used in returned datetime. Change-Id: I133635bfe3d35ee496a287257e13b2d600225a38 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QDateTime - Improve and expose Qt::OffsetFromUtcJohn Layt2013-08-281-63/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Qt::OffsetFromUtc TimeSpec was made public in Qt 4.4 but the access methods were never made public in the apidox effectively meaning the feature was never used. The implementation was also incomplete and inconsistent. This change cleans up the implementation and exports new public API for using the TimeSpec using new method names consistent with the new QTimeZone support. This change increases the QDataStream Version number for Qt 5.2 to 15. The behavior of one constructor has changed slightly to be consistent with the rest of the feature, but this behavior was never documented. [ChangeLog][QtCore][QDateTime] Fully implement support for Qt::TimeSpec of Qt::OffsetFromUTC, added new methods for offsetFromUTC(), toTimeSpec(), and toOffsetFromUTC(). Task-number: QTBUG-26161 Task-number: QTBUG-29666 Change-Id: If3cc7fc9778ca2b831644408ae749448d5975a3a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QDateTime - Fix tests to correctly restore time zoneJohn Layt2013-08-211-3/+7
| | | | | | | | | | | | The unit tests were caching the original TZ value to restore later after testing with different TZ values. The problem is reading TZ will return a null value if no override TZ value is set, and if you then set the TZ to null the system assumes UTC and not the system time zone. Instead we need to unset TZ if it was null to start with. Change-Id: Ib0625b1712e565f9fdfa99e2ffe1e5d74f059354 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add the RFC2822Date formatKevin Ottens2013-07-241-0/+113
| | | | | | | | | | | QDateTime can now be converted to strings compliant to RFC 2822. Additionally, it supports RFC 850 and RFC 1036 during parsing. By having them all together, all type of dates found in exchanged messages on the internet (including USENET) get supported. Change-Id: I771066c23f409d20b31b7d802f37852ea68ca2a0 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Fix roundtrip conversion of datetimes.Mitch Curtis2013-06-171-0/+2
| | | | | | | | | | | | | | | | QDateTime.toString() is writing out milliseconds since change 15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c. Unfortunately this breaks QDateTime::fromString() with Qt::TextDate which can't handle the new format. Fix by making QDateTime::fromString split up seconds and milliseconds on a period, if any. Now QDateTime dt = ...; assert(QDateTime::fromString(dt.toString(), Qt::TextDate) == dt) works again. Change-Id: Ibfe9032e357ceaf894e33f3e33affe94f56dbf5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QTime::toString output milliseconds for Qt::TextDate, Qt::ISODate.Mitch Curtis2013-06-031-5/+8
| | | | | | | | | | | | | | | Section 4.2.2.4 of ISO 8601 allows for decimal fraction representations of dates and times. Currently, when calling QDateTime::toString(Qt::TextDate) or QDateTime::toString(Qt::ISODate), the milliseconds will be omitted. However, QDateTime::fromString(str, Qt::TextDate) and QDateTime::fromString(str, Qt::ISODate) already support decimal fraction representations, so this patch just adds this support to QTime::toString, and hence QDateTime::toString(). Task-number: QTBUG-30250 Change-Id: If58e4b3d3105322c51d11a76b832e5e634d8991f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert QDateTime serialisation to pre-Qt 5 behaviour.Mitch Curtis2013-05-081-3/+17
| | | | | | | | | | | | | | In Qt 5, I managed to break the guarantee that a deserialised local datetime is the same time of day (potentially different UTC time), regardless of which timezone it was serialised in. This happened after I fixed QTBUG-4057 with If650e7960dca7b6ab44b8233410a6369c41df73a, which serialised datetimes as UTC. This patch reverts QDateTime serialisation to pre-Qt 5 behaviour to restore the guarantee and consequently re-opens QTBUG-4057. Change-Id: Iea877f7ed886f530b928067789b53534e89fe8cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime - Fix auto tests on Windows before 1980unknown2013-04-121-0/+15
| | | | | | | | | | | Auto tests using CET expect there to be no Daylight Time before 1980, but Windows does apply Daylight Time. Fix expected test results to match. Task-number: QTBUG-30420 Change-Id: I7080598fa0a20c1cd5680782606ab983e714e546 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Merge remote-tracking branch 'gerrit/release' into stableSamuel Rødal2013-03-211-6/+0
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure mkspecs/features/qt_module_headers.prf mkspecs/features/qt_tool.prf src/angle/angle.pro src/tools/bootstrap/bootstrap.pro tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: Ide5759fe419a50f1c944211a48f7c66f662684e0