Use high_resolution_clock instead of clock

This commit is contained in:
Atlante45 2015-08-26 19:36:18 +02:00
parent 7a5ed24485
commit cd8d6df287
2 changed files with 5 additions and 5 deletions

View file

@ -226,7 +226,7 @@ void SendQueue::run() {
while (_isRunning) {
// Record how long the loop takes to execute
auto loopStartTimestamp = clock::now();
auto loopStartTimestamp = high_resolution_clock::now();
bool sentAPacket = maybeResendPacket();
bool flowWindowFull = false;
@ -256,7 +256,7 @@ void SendQueue::run() {
if (!sentAPacket) {
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,
// then signal the queue is inactive
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
auto timeToSleep = (loopStartTimestamp + std::chrono::microseconds(_packetSendPeriod)) - loopEndTimestamp;

View file

@ -42,8 +42,8 @@ class SendQueue : public QObject {
Q_OBJECT
public:
using clock = std::chrono::high_resolution_clock;
using time_point = clock::time_point;
using high_resolution_clock = std::chrono::high_resolution_clock;
using time_point = high_resolution_clock::time_point;
static std::unique_ptr<SendQueue> create(Socket* socket, HifiSockAddr destination);