X-Git-Url: http://git.meshlink.io/?p=utcp;a=blobdiff_plain;f=utcp.c;h=2ef56ea76a451558d19d6963679f1d9c5a7e8b6c;hp=391706f1d1abdee0ecf8a8edf7b2dc45f6cdd40d;hb=5e2471e7e38b68745668aa9c3b1d55297895bba2;hpb=36555fb967087c22ec8854b4cad158f7d2688c5b diff --git a/utcp.c b/utcp.c index 391706f..2ef56ea 100644 --- a/utcp.c +++ b/utcp.c @@ -1061,7 +1061,7 @@ static void retransmit(struct utcp_connection *c) { * The return value is the time to the next timeout in milliseconds, * or maybe a negative value if the timeout is infinite. */ -int utcp_timeout(struct utcp *utcp) { +struct timeval utcp_timeout(struct utcp *utcp) { struct timeval now; gettimeofday(&now, NULL); struct timeval next = {now.tv_sec + 3600, now.tv_usec}; @@ -1111,9 +1111,7 @@ int utcp_timeout(struct utcp *utcp) { struct timeval diff; timersub(&next, &now, &diff); - if(diff.tv_sec < 0) - return 0; - return diff.tv_sec * 1000 + diff.tv_usec / 1000; + return diff; } struct utcp *utcp_init(utcp_accept_t accept, utcp_pre_accept_t pre_accept, utcp_send_t send, void *priv) {