From 4153d9d65e5be6ff6cab9d9603ff63ab13c5956a Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 29 Oct 2012 15:44:25 +0200 Subject: [PATCH] examples: Make sure the timeout parameter to select is valid This makes the example work properly on Mac OS X (tested on 10.8). Signed-off-by: Nikos Mavrogiannopoulos --- doc/examples/ex-serv-dtls.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/examples/ex-serv-dtls.c b/doc/examples/ex-serv-dtls.c index adcc7eb38..04cc26b91 100644 --- a/doc/examples/ex-serv-dtls.c +++ b/doc/examples/ex-serv-dtls.c @@ -296,6 +296,12 @@ pull_timeout_func (gnutls_transport_ptr_t ptr, unsigned int ms) tv.tv_sec = 0; tv.tv_usec = ms * 1000; + while(tv.tv_usec >= 1000000) + { + tv.tv_usec -= 1000000; + tv.tv_sec++; + } + ret = select (priv->fd + 1, &rfds, NULL, NULL, &tv); if (ret <= 0) -- 2.11.4.GIT