summaryrefslogtreecommitdiffstats
path: root/src/corelib/time
Commit message (Collapse)AuthorAgeFilesLines
* Fix qdoc warningsFriedemann Kleint2019-09-102-1/+3
| | | | | | | | | | | | | src/corelib/global/qnamespace.qdoc:3279: (qdoc) warning: Can't link to 'QGuiApplication::setHighDdpiScaleFactorRoundingPolicy()' src/corelib/time/qislamiccivilcalendar.cpp:49: (qdoc) warning: Can't link to 'QJijriCalendar' src/network/ssl/qsslsocket.cpp:1510: (qdoc) warning: Can't link to 'QSslConfiguration::defaultCaCertificates()' src/network/access/qhttp2configuration.cpp:49: (qdoc) warning: '\brief' statement does not end with a full stop. src/gui/text/qtextformat.cpp:532: (qdoc) warning: Undocumented enum item 'TableBorderCollapse' in QTextFormat::Property src/gui/text/qtextdocument.cpp:2066: (qdoc) warning: Undocumented enum item 'UnknownResource' in QTextDocument::ResourceType src/gui/kernel/qguiapplication.cpp:3500: (qdoc) warning: Undocumented parameter 'policy' in QGuiApplication::setHighDpiScaleFactorRoundingPolicy() Change-Id: I3573ef98cf9b58d16525c356270fe009fdffcf45 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Clarify documentation of daysInMonth()Edward Welbourne2019-09-051-3/+4
| | | | | Change-Id: I86258512c33cabec8d11ff3c794934f40850e413 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Refine QCalendar::hasYearZero()'s documentationEdward Welbourne2019-09-051-23/+23
| | | | | Change-Id: I06697485c6be1c31998d0da54b357f3f5c8701e7 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Rename calendar methods from m{in,ax} to m{in,ax}imumEdward Welbourne2019-09-048-46/+49
| | | | | | | | | Words should not be abbreviated. Split a long line and reflowed some comments in the process. Fixes: QTBUG-78008 Change-Id: I52d75409f02e2cecbed3e94d424617ad594c275b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix some qdoc warnings in 5.14Friedemann Kleint2019-09-034-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QCalendarBackend as internal since it is in a private header and fix some issues in the QCalendar related classes. src/corelib/time/qcalendar.cpp:201: (qdoc) warning: clang found diagnostics parsing \fn int QCalendarBackend::daysInMonth(int month, int year) const error: incomplete type 'QCalendarBackend' named in nested name specifier (repeats) src/corelib/time/qdatetime.cpp:1426: (qdoc) warning: Unknown command '\override' (repeats) src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'Last' in QCalendar::System src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'User' in QCalendar::System src/corelib/time/qcalendar.cpp:744: (qdoc) warning: Undocumented parameter 'year' in QCalendar::isLeapYear() src/corelib/time/qcalendar.cpp:923: (qdoc) warning: Can't link to 'dateTimeString()' (repeats) src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'year' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'month' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'day' in QCalendar::partsFromDate() src/corelib/time/qdatetime.cpp:1425: (qdoc) warning: Undocumented parameter 'nmonths' in QDate::addMonths() src/corelib/time/qdatetime.cpp:1467: (qdoc) warning: Undocumented parameter 'nyears' in QDate::addYears() src/corelib/statemachine/qstatemachine.cpp:2522: (qdoc) warning: Undocumented enum item 'StateMachineChildModeSetToParallelError' in QStateMachine::Error src/corelib/kernel/qtimer.cpp:602: (qdoc) warning: Undocumented parameter 'connectionType' in QTimer::callOnTimeout() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'name' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'id' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'registerCalendar()' src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'fromName()' src/corelib/time/qcalendar.cpp:178: (qdoc) warning: Can't link to 'QCalendar::fromEnum()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Undocumented parameter 'jd' in QCalendarBackend::dayOfWeek() src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'weekDayName()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'standaloneWeekDayName()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'isLeapYear()' src/corelib/time/qcalendar.cpp:295: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLuniSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLunar()' src/corelib/time/qcalendar.cpp:340: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:357: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:544: (qdoc) warning: Can't link to 'fromName()' Change-Id: Ia2fabefb917f8e4cfa361044d9b754717276f4aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix spelling of primarily in QCalendar::isSolar()'s docEdward Welbourne2019-08-301-1/+1
| | | | | | | It was missing a y. Change-Id: I12dac02e451addff966f554811ca1999acadbb1b Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
* QDateTimeParser: replace QVector with QVarLengthArray<12>Marc Mutz2019-08-301-3/+6
| | | | | | | | | | | | | The lists of month and day-of-week names usually currently do not exceed 13 elements (incl. possible leap months), so don't use QVector, use QVarLengthArray with Prealloc = 13. This value may be increased when ISO week-as-month is merged, but the container remains valid even with 52 "months" (though the code that calculates its runtime size will naturally need to be adjusted). Change-Id: I4ead897d933f89fc092850fcc22ca41da0a6ddc6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Pass QDate, QTime as value classes, rather than by const referenceEdward Welbourne2019-08-301-8/+8
| | | | | | | | | This can, of course, only be done in private APIs - but comment on public APIs to do the same at Qt 6. Change-Id: I3c79951572be3c37b0b0c5b1b05bced051a40964 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Optimize QDate by shortcutting some gregorian calendar methodsEdward Welbourne2019-08-303-15/+139
| | | | | | | | | | Add some static methods to QGregorianCalendar, some of which serve to implement its methods, that QDate can use to bypass vtables and exploit fixed truths of the Gregorian calendar in its default handling. Change-Id: Iec191cdf4d52945dbd5679e609180cb4fe59b5fd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for the Islamic Civil calendarSoroush Rabiei2019-08-228-3/+1589
| | | | | | | | | | | | | | | | This has its own locale data, extracted from CLDR. This data may potentially be shared with other variants on the Islamic calendar, so is handled by a separate base-class, QHijriCalendar, on which such variants may base their implementations. [ChangeLog][QtCore][QCalendar] Added support for the Islamic Civil calendar, controlled by feature islamiccivilcalendar, with locale data that can be shared with other implementations, controlled by feature hijricalendar. Fixes: QTBUG-56675 Change-Id: Idf32d3da7034baa8ec5e66ef847e59a8a2f31cbd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for the Jalali (Solar Hijri or Persian) calendarSoroush Rabiei2019-08-216-1/+1214
| | | | | | | | | | | | This has its own locale data, extracted from CLDR. [ChangeLog][QtCore][QCalendar] Added support for the Jalali (Persian or Solar Hijri) calendar, controlled by feature jalalicalendar. Fixes: QTBUG-58404 Change-Id: Id5c56a10db05a4fd612aafc01615273db81ec743 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for Julian and Milankovic calendarsSoroush Rabiei2019-08-219-4/+444
| | | | | | | | | | | | | These share their locale data with the Gregorian calendar, making them virtually free to add. Still leave them out of the boot-strap build, though. [ChangeLog][QtCore][QCalendar] Added support for Julian and Milankovic calendars. These are enabled by default, except in bootstrap builds. Change-Id: I585045ed9e78c1e959957f6772b3e144093b701c Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for calendars beside GregorianSoroush Rabiei2019-08-2014-335/+4996
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add QCalendarBackend as a base class for calendar implementations and QCalendar as a facade via which to access it. QDate's implicit implementation of the Gregorian calendar becomes QGregorianCalendar and QDate methods now support choice of calendar. Convert QLocale's CLDR data for month names to a locale-data component of each supported calendar and relevant QLocale methods now support choice of calendar. Adapt Python scripts for locale data generation to extract month name data from CLDR (keeping on version v35.1) into the new calendar-locale files. The locale data for the Gregorian calendar is held in a Roman calendar base, for sharing with other calendars. Add tests for basic uses of the new API. [ChangeLog][QtCore][QCalendar] Added QCalendar to support diverse calendars, supported by implementing QCalendarBackend. [ChangeLog][QtCore][QDate] Allow choice of calendar in various operations, with Gregorian remaining the default. Done-with: Lars Knoll <lars.knoll@qt.io> Done-with: Edward Welbourne <edward.welbourne@qt.io> Fixes: QTBUG-17110 Fixes: QTBUG-950 Change-Id: I9d6278f394269a183aee8156e990cec4d5198ab8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDateTimePrivate: inherit QSharedData and other cleanupsMarc Mutz2019-08-071-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't manage the ref-count yourself, as this requires the code to use the QAtomic copy ctor, which we want to remove going forward. Using QSharedData, we can let the compiler write the code for us. Since 'ref' this way moves to the first spot in the list of effective members, creating a 4B hole between itself and 'msecs', swap 'status' and 'msecs' to fill the hole: offset: 0 8 16 24 | | | | without v v v v adj.mnt: |*R*| | msecs | S | U | TZ.... before: | msecs | S | U |*R*| | TZ... after: |*R*| S | msecs | U | | TZ.... This keeps the padding out of the critical first word, which improves latency. That said, for accessing the members the old layout surely was optimal. This layout optimizes copies and pessimizes access to 'msecs' on 32-bit platforms without the Critical Word First optimization. Requires adjustments to tst_toolsupport and the qhooks version. Also default members using NSDMI, consequently drop the manual default ctor. Change-Id: I3c48e68694ad29b28a13aa47ea0f283fae52edd7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify QDate::weekNumber() by looking at the right day of the weekEdward Welbourne2019-08-071-27/+14
| | | | | | | | | The Thursday in the same week has the same week-number and determines the right year to use for the week. So calculate its week-number and save a whole lot of complications. Change-Id: I9c28267e6083afdd04a15245e1609c64beb82b37 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port from QStringViewLiteral to u""Marc Mutz2019-07-291-4/+4
| | | | | | | | | Now that all our supported compilers know char16_t, we no longer need QStringViewLiteral, whose only purpose in life was to turn u"" into L"" for MSVC < 2015. Change-Id: I25a094fe7992d9d5dbeb4a524d9e99e043dcb8ce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix typo: s/QLocal/QLocale/Edward Welbourne2019-07-261-1/+1
| | | | | | | | | This amends commit 1d8c9978fa1baafa17c95713bd5d04f245eeb76f in which I perpetrated this typo. Change-Id: Iccfc14aff7c4f3976b92919c8e8dc4b7906642ae Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-191-21/+13
| | | | Change-Id: I999ba23a27cd897017d15c6ffe41ea8cd008ffb9
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-101-4/+3
| | | | | | | | Conflicts: src/corelib/time/qdatetime.cpp src/widgets/widgets/qcombobox.h Change-Id: Ib84352e8fe34aed2986a1c94e7346a46a71c803b
* Move YearRange to QDateTime from its PrivateEdward Welbourne2019-07-014-9/+27
| | | | | | | | | | | | | | | | | As planned when adding YearRange: now that it's merged up to dev, move it to QDateTime, since we can add to the API at 5.14.0. This follows up on commit 82ad4be4a2e0c2bccb6cd8ea2440aefee4ec48ec. Change-Id: I81b6c2331121a71e2592514781c02c5756e70c52 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rtems: Fix build qdatetime.cppMikhail Svetkin2019-06-301-1/+1
| | | | | | | | | | | | | | | | RTEMS does not have "timezone" global variable. Change-Id: Ifa4c6f8939270a83fb7b5ba623daafa1e9f81003 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix qdoc warnings in 5.14Friedemann Kleint2019-06-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Fix warning: src/corelib/global/qnamespace.qdoc:2371: (qdoc) warning: Cannot find 'Qt::SplitBehavior' specified with '\enum' in any header file and qdoc getting confused by a link spanning lines: src/corelib/time/qdatetime.cpp:3324: (qdoc) warning: Unknown macro 'note' src/corelib/time/qdatetime.cpp:3326: (qdoc) warning: Unknown macro 'section1' src/corelib/time/qdatetime.cpp:3328: (qdoc) warning: Unknown macro 'section2' src/corelib/time/qdatetime.cpp:3334: (qdoc) warning: Unknown macro 'section2' src/corelib/time/qdatetime.cpp:3344: (qdoc) warning: Unknown macro 'section2' src/corelib/time/qdatetime.cpp:3361: (qdoc) warning: Unknown macro 'section2' src/corelib/time/qdatetime.cpp:3373: (qdoc) warning: Unknown macro 'e' src/corelib/time/qdatetime.cpp:3378: (qdoc) warning: Unknown macro 'section2' src/corelib/time/qdatetime.cpp:3386: (qdoc) warning: Unknown macro 'sa' Change-Id: I314da69078eb07f66e9d389eecdf0195569ea2ce Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-06-271-12/+15
| | | | | | | | | Conflicts: .qmake.conf src/network/ssl/qsslsocket_openssl.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ibb57a0548b4977797b400637487a56245ac1c024
* Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-3/+3
| | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QTimeZone: avoid needless QString instancesRolf Eike Beer2019-06-191-3/+3
| | | | | | | | | | | | Change-Id: I250bfb58c04b2c013285c8ebd6db1f964f0b7b29 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-06-142-101/+141
| | | | | | | | | | Conflicts: qmake/generators/makefile.cpp qmake/generators/unix/unixmake2.cpp src/corelib/thread/qthread_unix.cpp tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp Change-Id: I1df0d4ba20685de7f9300bf07458c13376493408
* Rearrange date parsing in anticipation of calendar workEdward Welbourne2019-06-071-34/+29
| | | | | | | | | | | | | The calendar APIs shall need fromShortMonthName() to know its year number; so rearrange the date parsing that uses it to ensure the year number is known in time. In the process, pass &ok to toInt() also for the calls that get a day number (where failure's 0 return is an adequate check for failed parse), just to be on the safe side. Change-Id: Id09c40da9f7e70e68be440e9805a3d30a80977c6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move away from using 0 as a pointer constantAllan Sandfeld Jensen2019-06-071-15/+15
| | | | | | | | | Cleans up most of corelib to use nullptr or default enums where appropriate. Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Separate out the time, zone, date code from corelib/tools/Edward Welbourne2019-06-0616-0/+15693
We'll be adding calendar code here as well, and tools/ was getting rather crowded, so it looks like time to move out a reasonably coherent sub-bundle of it all. Change-Id: I7e8030f38c31aa307f519dd918a43fc44baa6aa1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>