mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 21:17:08 +02:00
Use high_resolution_clock instead of clock
This commit is contained in:
parent
7a5ed24485
commit
cd8d6df287
2 changed files with 5 additions and 5 deletions
|
@ -226,7 +226,7 @@ void SendQueue::run() {
|
||||||
|
|
||||||
while (_isRunning) {
|
while (_isRunning) {
|
||||||
// Record how long the loop takes to execute
|
// Record how long the loop takes to execute
|
||||||
auto loopStartTimestamp = clock::now();
|
auto loopStartTimestamp = high_resolution_clock::now();
|
||||||
|
|
||||||
bool sentAPacket = maybeResendPacket();
|
bool sentAPacket = maybeResendPacket();
|
||||||
bool flowWindowFull = false;
|
bool flowWindowFull = false;
|
||||||
|
@ -256,7 +256,7 @@ void SendQueue::run() {
|
||||||
if (!sentAPacket) {
|
if (!sentAPacket) {
|
||||||
static const std::chrono::seconds CONSIDER_INACTIVE_AFTER { 5 };
|
static const std::chrono::seconds CONSIDER_INACTIVE_AFTER { 5 };
|
||||||
|
|
||||||
if (flowWindowFull && (clock::now() - _flowWindowFullSince) > CONSIDER_INACTIVE_AFTER) {
|
if (flowWindowFull && (high_resolution_clock::now() - _flowWindowFullSince) > CONSIDER_INACTIVE_AFTER) {
|
||||||
// If the flow window has been full for over CONSIDER_INACTIVE_AFTER,
|
// If the flow window has been full for over CONSIDER_INACTIVE_AFTER,
|
||||||
// then signal the queue is inactive
|
// then signal the queue is inactive
|
||||||
emit queueInactive();
|
emit queueInactive();
|
||||||
|
@ -285,7 +285,7 @@ void SendQueue::run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto loopEndTimestamp = clock::now();
|
auto loopEndTimestamp = high_resolution_clock::now();
|
||||||
|
|
||||||
// sleep as long as we need until next packet send, if we can
|
// sleep as long as we need until next packet send, if we can
|
||||||
auto timeToSleep = (loopStartTimestamp + std::chrono::microseconds(_packetSendPeriod)) - loopEndTimestamp;
|
auto timeToSleep = (loopStartTimestamp + std::chrono::microseconds(_packetSendPeriod)) - loopEndTimestamp;
|
||||||
|
|
|
@ -42,8 +42,8 @@ class SendQueue : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using clock = std::chrono::high_resolution_clock;
|
using high_resolution_clock = std::chrono::high_resolution_clock;
|
||||||
using time_point = clock::time_point;
|
using time_point = high_resolution_clock::time_point;
|
||||||
|
|
||||||
static std::unique_ptr<SendQueue> create(Socket* socket, HifiSockAddr destination);
|
static std::unique_ptr<SendQueue> create(Socket* socket, HifiSockAddr destination);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue