mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:35:08 +02:00
protect against unexpected rollover
This commit is contained in:
parent
541c1e5c6f
commit
fe31be71eb
1 changed files with 4 additions and 2 deletions
|
@ -271,8 +271,10 @@ public:
|
|||
while (!_quit) {
|
||||
QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS);
|
||||
auto now = usecTimestampNow();
|
||||
auto lastHeartbeatAge = now - _heartbeat;
|
||||
auto sinceLastReport = now - _lastReport;
|
||||
|
||||
// in the unlikely event that now is less than _heartbeat, don't rollover and confuse ourselves
|
||||
auto lastHeartbeatAge = (now > _heartbeat) ? now - _heartbeat : 0;
|
||||
auto sinceLastReport = (now > _lastReport) ? now - _lastReport : 0;
|
||||
auto elapsedMovingAverage = _movingAverage.getAverage();
|
||||
|
||||
if (elapsedMovingAverage > _maxElapsedAverage) {
|
||||
|
|
Loading…
Reference in a new issue