Revert "use time comparion functions"

This reverts commit 2d0ae6b82b.

Possibly not use this for relative timestamps.
This commit is contained in:
Olaf Bergmann committed 2013-11-08 17:00:08 +01:00
1 parent 2d0ae6b82b
commit c4cb5ce770
3 files changed
+6 -7

No files matched your search

+1 -2
View File
@@ -1112,8 +1112,7 @@ main(int argc, char **argv) {
nextpdu = coap_peek_next( ctx );
coap_ticks(&now);
while (nextpdu &&
coap_time_le(nextpdu->t, now - ctx->sendqueue_basetime)) {
while (nextpdu && nextpdu->t <= now - ctx->sendqueue_basetime) {
coap_retransmit( ctx, coap_pop_next( ctx ));
nextpdu = coap_peek_next( ctx );
}
+2 -2
View File
@@ -398,12 +398,12 @@ main(int argc, char **argv) {
nextpdu = coap_peek_next( ctx );
coap_ticks(&now);
while (nextpdu && coap_time_le(nextpdu->t, now - ctx->sendqueue_basetime)) {
while (nextpdu && nextpdu->t <= now - ctx->sendqueue_basetime) {
coap_retransmit( ctx, coap_pop_next( ctx ) );
nextpdu = coap_peek_next( ctx );
}
if (nextpdu && coap_time_le(nextpdu->t, COAP_RESOURCE_CHECK_TIME)) {
if ( nextpdu && nextpdu->t <= COAP_RESOURCE_CHECK_TIME ) {
/* set timeout if there is a pdu to send before our automatic timeout occurs */
tv.tv_usec = ((nextpdu->t) % COAP_TICKS_PER_SECOND) * 1000000 / COAP_TICKS_PER_SECOND;
tv.tv_sec = (nextpdu->t) / COAP_TICKS_PER_SECOND;
+3 -3
View File
@@ -101,7 +101,7 @@ coap_insert_node(coap_queue_t **queue, coap_queue_t *node) {
/* replace queue head if PDU's time is less than head's time */
q = *queue;
if (coap_time_lt(node->t, q->t)) {
if (node->t < q->t) {
node->next = q;
*queue = node;
q->t -= node->t; /* make q->t relative to node->t */
@@ -113,7 +113,7 @@ coap_insert_node(coap_queue_t **queue, coap_queue_t *node) {
node->t -= q->t; /* make node-> relative to q->t */
p = q;
q = q->next;
} while (q && coap_time_le(q->t, node->t));
} while (q && q->t <= node->t);
/* insert new item */
if (q) {
@@ -547,7 +547,7 @@ coap_send_confirmed(coap_context_t *context,
node->t = node->timeout;
context->sendqueue_basetime = now;
} else {
assert(coap_time_le(context->sendqueue_basetime,now));
assert(context->sendqueue_basetime <= now);
/* make node->t relative to context->sendqueue_basetime */
node->t = now + node->timeout - context->sendqueue_basetime;
}