QtCraft API C++ classes QML types Handbook

QcTickPacer Class

The due times of the client session's ticks (decision E-560): a fixed grid of one tick interval from the start, like the server's (QcTickScheduler, E-090). More...

Header: #include <clientcore/tick/QcTickPacer.h>

Public Functions

void start(qint64 nowNs)
int take(qint64 nowNs)
QcTickTiming &timing()
const QcTickTiming &timing() const
qint64 untilNextNs(qint64 nowNs) const

Static Public Members

const int maxCatchUp

Detailed Description

After a hold-up the ticks due since run back to back, at most maxCatchUp of them; older ones are dropped and the grid moves on, so a long stall does not turn into a burst of inputs the server would refuse. Plain logic on a given clock (nanoseconds) so tests drive it without waiting; records into its QcTickTiming. Used by one thread at a time; only timing() may be read from others.

Member Function Documentation

void QcTickPacer::start(qint64 nowNs)

The grid starts: the first tick is due one interval after nowNs.

int QcTickPacer::take(qint64 nowNs)

Returns the ticks to run at nowNs (0 to maxCatchUp), each recorded with its lateness; the due ticks beyond those are counted as missed.

QcTickTiming &QcTickPacer::timing()

Returns the punctuality of the ticks taken, writable.

const QcTickTiming &QcTickPacer::timing() const

Returns the punctuality of the ticks taken.

qint64 QcTickPacer::untilNextNs(qint64 nowNs) const

Returns the nanoseconds from nowNs until the next tick is due (0 when it is due already).

Member Variable Documentation

const int QcTickPacer::maxCatchUp

Ticks run back to back after a hold-up; the server takes that many inputs at once (its input budget is 10, QcServerClient::maxInputBudget).