]> git.tdb.fi Git - libs/net.git/blobdiff - source/socket.cpp
Use maputils
[libs/net.git] / source / socket.cpp
index 2cc3d88dbce4b2451909f5022b15008764bc7b2e..a4675f593b6bc95ed9e0d4ad40f442e5bcf78ee1 100644 (file)
@@ -4,7 +4,8 @@
 #include <sys/socket.h>
 #endif
 #include <iostream>
-#include <msp/strings/formatter.h>
+#include <msp/strings/format.h>
+#include <msp/time/rawtime_private.h>
 #include <msp/time/units.h>
 #include "socket.h"
 
@@ -109,10 +110,6 @@ void Socket::bind(const SockAddr &addr)
        local_addr = addr.copy();
 }
 
-/**
-Closes the socket.  Most operations on the socket will throw an exception after
-this.
-*/
 void Socket::close()
 {
        if(handle==MSP_NET_INVALID_SOCKET_HANDLE)
@@ -140,8 +137,7 @@ void Socket::close()
 void Socket::set_timeout(const Time::TimeDelta &timeout)
 {
 #ifndef WIN32
-       timeval tv;
-       timeout.fill_timeval(tv);
+       timeval tv = Time::rawtime_to_timeval(timeout.raw());
        set_option(SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(timeval));
        set_option(SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(timeval));
 #else