diff --git a/examples/server.c b/examples/server.c index 9a0f694e..643e8fa0 100644 --- a/examples/server.c +++ b/examples/server.c @@ -416,7 +416,7 @@ main(int argc, char **argv) { if ( nextpdu && nextpdu->t <= now + COAP_RESOURCE_CHECK_TIME ) { /* set timeout if there is a pdu to send before our automatic timeout occurs */ - tv.tv_usec = ((nextpdu->t - now) % COAP_TICKS_PER_SECOND) << 10; + tv.tv_usec = ((nextpdu->t - now) % COAP_TICKS_PER_SECOND) * 1000000 / COAP_TICKS_PER_SECOND; tv.tv_sec = (nextpdu->t - now) / COAP_TICKS_PER_SECOND; timeout = &tv; } else {