Commit 2eee12a6 authored by Andreas Schmidt's avatar Andreas Schmidt

Calculate pacing diff in int64_t.

parent e79120d4
......@@ -51,20 +51,20 @@ bool PrrtSocket_pace(PrrtSocket *s, bool prepace) {
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
if (s->pacingEnabled && s->nextSendTime != 0) {
debug(DEBUG_DATATRANSMITTER, "About to check for pacing.");
prrtTimeDifference_t diff = 0;
int64_t diff = 0;
do {
if(PrrtSocket_closing(s)) {
result = false;
break;
}
prrtTimeDifference_t now = (prrtTimeDifference_t) PrrtClock_get_current_time_us();
diff = ((prrtTimeDifference_t) s->nextSendTime) - now;
prrtTimestamp_t now = PrrtClock_get_current_time_us();
diff = PrrtTimestamp_cmp(s->nextSendTime, now);
if (!prepace) { // post-pacing removes appSendPace
//diff -= PrrtPace_get_max(s->appSendPace);
diff = MAX(0, diff);
}
if (diff > 0) {
usleep_nano((uint32_t) diff);
usleep_nano(diff);
}
} while (diff > 0);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment