Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_kernel_qdeadlinetimer.cpp
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5 void executeOperation(int msecs)
6 {
8 do {
10 break;
12 } while (!deadline.hasExpired());
13 }
15
17 using namespace std::chrono;
18 using namespace std::chrono_literals;
19
21 device->waitForReadyRead(deadline);
22 if (deadline.remainingTime<nanoseconds>() > 300ms)
23 cleanup();
25
27 using namespace std::chrono;
28 using namespace std::chrono_literals;
29 auto now = steady_clock::now();
33
35 using namespace std::chrono_literals;
38
40 using namespace std::chrono_literals;
43
47
50 if (realTimeLeft != (std::numeric_limits<qint64>::max)()) {
52 // or:
53 //QElapsedTimer timer;
54 //timer.start();
55 //realTimeLeft -= timer.msecsSinceReference();
56 }
58
61 if (realTimeLeft != std::numeric_limits<qint64>::max())
62 realTimeLeft -= QDeadlineTimer::current().deadlineNSecs();
64
66 return lhs.deadlineNSecs() == rhs.deadlineNSecs();
68
70 return lhs.deadlineNSecs() != rhs.deadlineNSecs();
72
74 return lhs.deadlineNSecs() < rhs.deadlineNSecs();
76
78 return lhs.deadlineNSecs() <= rhs.deadlineNSecs();
80
82 return lhs.deadlineNSecs() > rhs.deadlineNSecs();
84
86 return lhs.deadlineNSecs() >= rhs.deadlineNSecs();
IOBluetoothDevice * device
\inmodule QtCore
static QDeadlineTimer current(Qt::TimerType timerType=Qt::CoarseTimer) noexcept
Returns a QDeadlineTimer that is expired but is guaranteed to contain the current time.
void setRemainingTime(qint64 msecs, Qt::TimerType type=Qt::CoarseTimer) noexcept
Sets the remaining time for this QDeadlineTimer object to msecs milliseconds from now,...
qint64 deadline() const noexcept Q_DECL_PURE_FUNCTION
Returns the absolute time point for the deadline stored in QDeadlineTimer object, calculated in milli...
bool hasExpired() const noexcept
Returns true if this QDeadlineTimer object has expired, false if there remains time left.
qint64 remainingTime() const noexcept
Returns the remaining time in this QDeadlineTimer object in milliseconds.
qint64 deadlineNSecs() const noexcept Q_DECL_PURE_FUNCTION
Returns the absolute time point for the deadline stored in QDeadlineTimer object, calculated in nanos...
bool tryLock(int timeout=0) noexcept
Attempts to lock the mutex.
Definition qmutex.h:287
static bool readFromDevice(QIODevice *device, QJsonArray *allMetaObjects)
GLdouble s
[6]
Definition qopenglext.h:235
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
long long qint64
Definition qtypes.h:60
device waitForReadyRead(deadline)
void executeOperation(int msecs)
[0]
QDeadlineTimer deadline(30s)
QMutex mutex
[2]