diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2018-06-26 15:18:36 +0200 |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2018-06-26 15:18:36 +0200 |
commit | 9aa4bbdb885c5b5ab7c29ee598d0e6df14df1141 (patch) | |
tree | f41fbba1c9e30d1f3336864823ed73e43da3a064 /doc | |
parent | 8c405696b8f136eaea32b55e99ccdcae134662f7 (diff) | |
download | gnutls-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.c | 9 |
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); |