Move to milliseconds in recv_timeout()
diff --git a/library/net.c b/library/net.c
index 7336f21..9d02661 100644
--- a/library/net.c
+++ b/library/net.c
@@ -585,10 +585,10 @@
#if defined(POLARSSL_HAVE_TIME)
/*
- * Read at most 'len' characters, blocking for at most 'timeout' seconds
+ * Read at most 'len' characters, blocking for at most 'timeout' ms
*/
int net_recv_timeout( void *ctx, unsigned char *buf, size_t len,
- unsigned char timeout )
+ uint32_t timeout )
{
int ret;
struct timeval tv;
@@ -598,8 +598,8 @@
FD_ZERO( &read_fds );
FD_SET( fd, &read_fds );
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = ( timeout % 1000 ) * 1000;
ret = select( fd + 1, &read_fds, NULL, NULL, &tv );