summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2018-06-26 15:18:36 +0200
committerRolf Eike Beer <eike@sf-mail.de>2018-06-26 15:18:36 +0200
commit9aa4bbdb885c5b5ab7c29ee598d0e6df14df1141 (patch)
treef41fbba1c9e30d1f3336864823ed73e43da3a064 /doc
parent8c405696b8f136eaea32b55e99ccdcae134662f7 (diff)
downloadgnutls-9aa4bbdb885c5b5ab7c29ee598d0e6df14df1141.tar.gz
convert from milliseconds to timespec without loop
Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/ex-serv-dtls.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/doc/examples/ex-serv-dtls.c b/doc/examples/ex-serv-dtls.c
index 887b4b83df..23b51a1781 100644
--- a/doc/examples/ex-serv-dtls.c
+++ b/doc/examples/ex-serv-dtls.c
@@ -303,13 +303,8 @@ static int pull_timeout_func(gnutls_transport_ptr_t ptr, unsigned int ms)
FD_ZERO(&rfds);
FD_SET(priv->fd, &rfds);
- tv.tv_sec = 0;
- tv.tv_usec = ms * 1000;
-
- while (tv.tv_usec >= 1000000) {
- tv.tv_usec -= 1000000;
- tv.tv_sec++;
- }
+ tv.tv_sec = ms / 1000;
+ tv.tv_usec = (ms % 1000) * 1000;
ret = select(priv->fd + 1, &rfds, NULL, NULL, &tv);