From 771f013b6e740b318e678f1afc3453d2a327f5da Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Wed, 12 Apr 2017 22:40:34 +0200 Subject: [PATCH] coap-server.c: fixed resource check time calculation This change is a fix for issue #72 [1]. [1] https://github.com/obgm/libcoap/issues/72 --- examples/coap-server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/coap-server.c b/examples/coap-server.c index aa29db31a4..e5ee36f2ca 100644 --- a/examples/coap-server.c +++ b/examples/coap-server.c @@ -507,7 +507,7 @@ main(int argc, char **argv) { nextpdu = coap_peek_next( ctx ); } - if ( nextpdu && nextpdu->t <= COAP_RESOURCE_CHECK_TIME ) { + if (nextpdu && nextpdu->t <= (COAP_RESOURCE_CHECK_TIME * COAP_TICKS_PER_SECOND)) { /* 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;