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 /src/common.h | |
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 'src/common.h')
-rw-r--r-- | src/common.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/common.h b/src/common.h index f1c828ce40..20faf7d521 100644 --- a/src/common.h +++ b/src/common.h @@ -101,12 +101,8 @@ static int system_recv_timeout(gnutls_transport_ptr_t ptr, unsigned int ms) FD_ZERO(&rfds); FD_SET(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; return select(fd + 1, &rfds, NULL, NULL, &tv); } |