summaryrefslogtreecommitdiff
path: root/xs_socket.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-07 15:06:17 +0200
committerdefault <nobody@localhost>2022-10-07 15:06:17 +0200
commitd79591c277884772021cc2a9419da068b4abfa25 (patch)
tree99450a7fb45a8253d97c98a09845b3a5397a11f5 /xs_socket.h
parenta4cf695e60e0d4f79638cb1f37f78b524411efcf (diff)
Backport from xs.
Diffstat (limited to 'xs_socket.h')
-rw-r--r--xs_socket.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/xs_socket.h b/xs_socket.h
index e4a18ec..a3fe6a4 100644
--- a/xs_socket.h
+++ b/xs_socket.h
@@ -4,7 +4,7 @@
#define _XS_SOCKET_H
-int xs_socket_timeout(int s, float rto, float sto);
+int xs_socket_timeout(int s, double rto, double sto);
int xs_socket_server(char *addr, int port);
FILE *xs_socket_accept(int rs);
@@ -16,7 +16,7 @@ FILE *xs_socket_accept(int rs);
#include <netinet/in.h>
-int xs_socket_timeout(int s, float rto, float sto)
+int xs_socket_timeout(int s, double rto, double sto)
/* sets the socket timeout in seconds */
{
struct timeval tv;
@@ -24,14 +24,14 @@ int xs_socket_timeout(int s, float rto, float sto)
if (rto > 0.0) {
tv.tv_sec = (int)rto;
- tv.tv_usec = (int)((rto - (float)(int)rto) * 1000000.0);
+ tv.tv_usec = (int)((rto - (double)(int)rto) * 1000000.0);
ret = setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
}
if (sto > 0.0) {
tv.tv_sec = (int)sto;
- tv.tv_usec = (int)((sto - (float)(int)sto) * 1000000.0);
+ tv.tv_usec = (int)((sto - (double)(int)sto) * 1000000.0);
ret = setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv));
}