summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qtimerinfo_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QEventDispatcher*: port the Unix dispatchers to V2Thiago Macieira2024-03-131-22/+12
| | | | | | | | | | | They're all ported in one go because all the changes are the same and they all rely on QTimerInfoList. The changes are: - use Qt::TimerId to uniquely identify timer IDs - use Duration (nanoseconds) to specify the timer interval - rename registeredTimers() to timersForObject(), which is const Change-Id: I83dda2d36c904517b3c0fffd17b52958767d8a68 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTimerInfo: store nanoseconds instead of millisecondsThiago Macieira2024-03-131-16/+18
| | | | | | | | | | | | | | No change in behavior, other than the ability for the precise timers to be even more precise. There's a reduction in the stored interval range from 292 million years to 292 years, but there's no change in behavior because the timeout is stored as a steady_clock::time_point, which is nanoseconds with libstdc++ and libc++. Now, if there's an overflow, it'll happen on the call to registerTimer() instead of inside the calculation of the wake-up. Change-Id: I83dda2d36c904517b3c0fffd17b3d1f2d9505c1c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTimerInfo: correct CoarseTimer beyond the [20ms,20s] range earlierThiago Macieira2024-03-131-18/+16
| | | | | | | | Simplifies some code. Pick-to: 6.7 Change-Id: I83dda2d36c904517b3c0fffd17b3d18f2dfbc2b3 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTimerInfoList: change timerWait() to return std::optional<ms>Ahmad Samir2023-08-111-7/+8
| | | | | | | | | | | | | QEventDispatcherGlib: it used the out-parameter timespec to set a timeout in milliseconds, making timerWait() return milliseconds is more straightforward. Also timerWait() returns the time rounded to milliseconds, so the code in QEventDispatcherGlib that rounded up the timespec::tv_nsec part was no-op, tv_nsec was always 0 IIUC. In QEventDispatcherGlib, guard against overflow with qt_saturate. Change-Id: Ie6f78374d00cbe8a6adf7b50ed67c8c86ab4d29d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfo: refactor QTimerInfoAhmad Samir2023-07-191-6/+1
| | | | | | | | | | - Add a constructor - Initialize members in-class - Reorder the data members so as not to waste space between them, now all the padding is at the end Change-Id: Ic88200fbff049615a6a43e322e724cf619fc3cdb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfoList: don't inherit from a container in an exported classAhmad Samir2023-07-191-23/+22
| | | | | | | | | | | | | | | | | | | Instead use composition by using a container member; inheriting from containers has a couple of issues: - containers (STL and Qt) don't have virtual destructors, which means that deleting via a pointer to the base-class would be troublesome - as it turns out, inheriting from containers, QList in this case, in an exported derived-class could lead to binary-incompatibility issues (see linked bug report) Drive-by change: - group all private members in one place - make timerInsert() private, nothing should use it from outside the class anyway Change-Id: I69843835d8c854fa4b13e8b4ba3fb69f1484f6a6 Fixes: QTBUG-111959 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfoList: refactor unregisterTimers()Ahmad Samir2023-07-191-15/+17
| | | | | | | | | | | | - Use removeIf(), easier to reason about than removing from the list during iteration - Return true only if any timers were actually unregistered - Assert in QObject::event() that if the list returned by eventDispatcher->registeredTimers() isn't empty, then eventDispatcher->unregisteredTimers() returns true Change-Id: I739a3865b7524a7aab3ff0227e6a060ed98d6191 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfoList: use std::upper_bound/rotateAhmad Samir2023-07-191-12/+12
| | | | | Change-Id: I80899a8c652ac724b0efd82815dddc061fe9f5e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfoList: improve class encapsulationAhmad Samir2023-06-101-0/+13
| | | | | | | | | Replace the only usage of updateCurrentTime() outside of the class by a getter that checks if there are pending timers. And make updateCurrentTime() private. Change-Id: I148639b01abd75990cfc7b25bb1f466e45ab0c71 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfoList: cleanupAhmad Samir2023-06-101-74/+2
| | | | | | | | | | - Initialize member in-class - Remove redundant include - Remove QTIMERINFO_DEBUG related code, it hasn't been compiled for a long time, so it has bit-rotted, and its purpose isn't clear any more Change-Id: I874415e1edec7c4da03f697f5f9f8665d8b015a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfoList/Unix: use chrono::steady_clock::time_pointAhmad Samir2023-06-101-51/+42
| | | | | | | | I.e. use chrono first, see linked task for more details. Task-number: QTBUG-110059 Change-Id: Ie0908f9446957d4383fb7a70b67c16b78605a0f3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfoList: remove code that attempted to repair time on clock jumpsThiago Macieira2023-04-181-87/+0
| | | | | | | | | We only use monotonic clocks now (std::chrono::steady_clock). This probably didn't work very well anyway. Change-Id: Ieec322d73c1e40ad95c8fffd17465f06b5b2816f Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Corelib: s/Q_OS_MAC/Q_OS_DARWIN/wg except for doc and definitionEdward Welbourne2023-03-201-2/+2
| | | | | | | | | | I got tired of being told off by the inanity 'bot for faithfully reflecting existing #if-ery in new #if-ery. Retain only the documentation and definition of the deprecated define. Change-Id: I47f47b76bd239a360f27ae5afe593dfad8746538 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QTimerInfo: fix lambda nameAhmad Samir2023-03-171-3/+4
| | | | | | | | | We are trying to find the first time in the list that has not expired. Drive-by change: fix a narrowing conversion warning Change-Id: I9e5f95b0f9d767f1fda9061c928e3182f4be6a85 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* q_core_unix: take timespec args by valueAhmad Samir2023-03-011-7/+3
| | | | | | | | | | From the review, timespecS are trivial and small, so they get passed in registers anyway. Change-Id: Iedf1f17af1fd58643a0c103230b1fea3c2fe1e49 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* q_core_unix: move timspec<->chrono helpers from qtools_p.hAhmad Samir2023-02-251-1/+1
| | | | | | | | | | Where it has a home with its other timespec/chrono siblings. Luckily I only needed to change one place in the code, and that source file already has #include's q_core_unix_p.h. Change-Id: I783383f958ceccfd6f9210f0b76d35b0f82b7cb5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfo: replace a goto with a lambdaAhmad Samir2023-02-241-58/+66
| | | | | | | | | More readable and now we can return earlier in an already long method. (Patch best viewed in terminal: `git show -W --ignore-all-space` :)). Change-Id: Ia405cdb91966b993cf7130c662bc1d189ff2c155 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfo: use range-for; use STL algorithmsAhmad Samir2023-02-241-57/+39
| | | | | | Change-Id: I7e1b603540a2a2b4d1b12d4dbdba7e9183ee367f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* QTimerInfo: don't shadow member variable nameAhmad Samir2023-02-241-19/+19
| | | | | | | | "currentTime", which one? the member, a local var or a method arg?! Change-Id: I7f8269ef15a8a901e47e4f83f8e16f185fe8b8f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* QTimerInfo: use chrono for time intervalsAhmad Samir2023-02-241-73/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For VeryCoarseTimer: - The code used to convert QTimerInfo::interval to seconds in registerTimer(), then convert to milliseconds when creating QTimerInfo in registeredTimers(); this is a bit confusing as "interval" was sometimes milliseconds and sometimes seconds depending on the type of the timer; instead "round" to the nearest second while always keeping "interval" in milliseconds (relying on chrono doing the conversion).. - Add roundToSecs() helper; it behaves like the original code (i.e. rounding each 500ms to 1 full second): const auto list = {300, 499, 500, 600, 1000, 1300, 1499, 1500, 1501, 1600, 2000, 2300, 2499, 2500, 2600}; using namespace std::chrono; for (int dur : list) { auto i = dur; i /= 500; i += 1; i >>= 1; // Original code milliseconds msec{dur}; seconds secs = duration_cast<seconds>(msec); milliseconds frac = msec - secs; if (frac >= 500ms) secs += 1s; assert(i == secs.count()); } ---- - Don't mix signed and unsigned when doing arithmetic The next "chrono-first" step would be changing QAbstractEventDispatcher::TimerInfo::interval from int to chrono::milliseconds, and adding a virtual QAbstractEventDispatcher::registerTimer() overload that takes chrono::milliseconds; neither can be done until Qt7 due to binary compatibility constraints, c.f.: https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C++ Task-number: QTBUG-110059 Change-Id: I36f9bd8fb29565b1131afb3cdfc313452f625598 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* q_core_unix_p.h: use std::chrono for time intervalsAhmad Samir2023-02-241-26/+0
| | | | | | | | Also move some timespec helpers from qtimerinfo_unix.cpp to q_core_unix_p.h, so that similar functions are grouped in one place. Change-Id: I817733dd70607a1f4243a9745626f5c9b37ddc2a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtMiscUtils: add std::chrono::duration <-> timespec helpersAhmad Samir2023-02-201-2/+2
| | | | | | Change-Id: I91f36a3d651fd57443072fde4c3e8f811682328e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimerInfo/Unix: use chrono for time arithmeticAhmad Samir2022-11-111-5/+9
| | | | | Change-Id: I2e193e2293c15e722d2e5c32ac8f7db1b5b7514a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-111-1/+1
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Avoid detaching in QBasicTimerhjk2022-09-281-1/+1
| | | | | | | | Amends da12a40b8b2c2d212412a9db6d7971dc43bce6e6 Change-Id: I2a9e46844a88f7ee239c7306abca3d2c8f7b53d9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Migrate QBasicTimer from int to qint64Konrad Kujawa2022-08-301-6/+5
| | | | | | | QBasicTimer::start() now accepts qint64 instead of int. Change-Id: Iba3f394b6c20daf762f1add5a9eed22c8a67c802 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QTimerInfo/Unix: Fix roundToMillisecond when it's already roundedThiago Macieira2022-02-111-2/+9
| | | | | | | | | | | | | | Don't add 1 ms when it's rounded to 1 ms. Found when running unit tests on QNX, where the clock did not update between two subsequent calls to clock_gettime(). All of this ought to be refactored to use std::chrono::nanoseconds. Fixes: QTBUG-100438 Pick-to: 6.2 6.3 Change-Id: I47dc6426c33d3a66dec946ae3589694745ed1835 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Document a peculiarity that might plausibly confuse readersEdward Welbourne2021-03-261-2/+5
| | | | | | | | | | | | | | | It at first sight seems perverse to null-check a variable we've repeatedly dereferenced before, without visibly setting it since; however, its address was stored where an event handler could get at it, to clear it if deleting the object it points to. The check against null really is needed, but the reason is non-obvious; so document the reason and save the next developers to come this way some confusion. In the process, relocate a related comment that belonged one line earlier. Change-Id: Id67b86edc5a9a76a827d66b5c0abcd017d98a2bb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractEventDispatcher: change event dispatcher timer interval to qint64Liu Yang2020-09-211-1/+1
| | | | | | | | | Resolve remaining Qt6 TODO [ChangeLog][QtCore][QAbstractEventDispatcher] The signature of the abstract virtual registerTime function now takes a qint64 value for the interval parameter. Change-Id: I10166ad5cfb455edc404d465a3731ff094a8977e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove obsolete native client platformMorten Johan Sørvig2020-09-031-5/+1
| | | | | Change-Id: Ia27cfbb618d216c371a0f8210f0bec483d4f15db Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-10/+10
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Prefix textstream operators with Qt::Lars Knoll2019-05-021-4/+4
| | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Support C++17 fallthrough attributeAllan Sandfeld Jensen2016-08-191-2/+1
| | | | | | | | | Replaces our mix of comments for annotating intended absence of break in switches with the C++17 attribute [[fallthrough]], or its earlier a clang extension counterpart. Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CoreLib: use const (and const APIs) moreAnton Kudryavtsev2016-04-181-1/+1
| | | | | | | | | | For CoW types const methods will be called. Mark store_persistent_indexes() as const, because this method does not modify the object. Change-Id: Ic867913b4fb5aaebfbaaffe1d3be45cf7b646403 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<Kai Koehne2015-02-091-1/+3
| | | | | | | | | Unify the behavior of the different operator<< by always using QDebugStateSaver (appending an optional space at exit), and making sure that the space(), nospace() setting isn't 'leaked'. Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.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>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-1/+1
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Remove use of 'register' from Qt.Stephen Kelly2013-06-171-10/+10
| | | | | | | | | | It is deprecated and clang is starting to warn about it. Patch mostly generated by clang itself, with some careful grep and sed for the platform-specific parts. Change-Id: I8058e6db0f1b41b33a9e8f17a712739159982450 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-03-051-3/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure qmake/generators/mac/pbuilder_pbx.cpp src/corelib/kernel/qtimerinfo_unix.cpp src/plugins/platforms/cocoa/qcocoabackingstore.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: I8d125fe498f5304874e6976b53f588d3e98a66ac
| * Rename qAbs Function for timevalDavid E. Narváez2013-02-241-3/+2
| | | | | | | | | | | | | | | | | | This decouples it from qAbs which is declared as a constexpr under certain compilation flags and enables for qtbase to be compiled with GCC 4.8 Change-Id: I78e02256ffc8b460ca74ae5241e77dfac4e09ba9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Switch to struct timespec everywhere instead of timevalThiago Macieira2013-01-281-41/+41
|/ | | | | | | | | | | | This avoids an extra division by 1000 when getting the current time. This can't overflow, under normal circumstances, even on 32-bit: when adding two values less than 1 billion, the result is less than 2 billion, which is less than 2^31. Change-Id: I6f8e1aadfe2fcf6ac8da584eab4c1e61aee51cbb Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Add a remainingTime() method to the public interface of the QTimer classLaszlo Papp2012-04-031-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is an extension coming from the use case when you, for instance, need to implement a countdown timer in client codes, and manually maintain a dedicated variable for counting down with the help of yet another Timer. There might be other use cases as well. The returned value is meant to be in milliseconds, as the method documentation says, since it is reasonable, and consistent with the rest (ie. the interval accessor). The elapsed time is already being tracked inside the event dispatcher, thus the effort is only exposing that for all platforms supported according to the desired timer identifier, and propagating up to the QTimer public API. It is done by using the QTimerInfoList class in the glib and unix dispatchers, and the WinTimeInfo struct for the windows dispatcher. It might be a good idea to to establish a QWinTimerInfo (qtimerinfo_win{_p.h,cpp}) in the future for resembling the interface for windows with the glib/unix management so that it would be consistent. That would mean abstracting out a base class (~interface) for the timer info classes. Something like that QAbstractTimerInfo. Test: Build test only on (Arch)Linux, Windows and Mac. I have also run the unit tests and they passed as well. Change-Id: Ie37b3aff909313ebc92e511e27d029abb070f110 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>