started cleanup up the socket mess

removed unused #include + dependency

more formatting fixes + fixed users of ReceiveSocket

cleaned more stuff up (converted from references to pointers is one)

wip. started rewriting everything, not quite finished

got everything except SensorOutput done (I think...)

got everything compiling except for missing SensorReceiver

worked on implementing the logic. didn't finish

made everything compile and finished implementing SensorReceiver

pulling over Austin's mock time stuff

added IncrementMockTime

finished up and started on tests

remembered something else
diff --git a/aos/common/network/SendSocket.h b/aos/common/network/SendSocket.h
index 27021e0..a0c1fe2 100644
--- a/aos/common/network/SendSocket.h
+++ b/aos/common/network/SendSocket.h
@@ -7,6 +7,7 @@
 
 class SendSocket : public Socket {
  public:
+  //inline int Send(const void *buf, int length) { return Socket::Send(buf, length); }
   // Connect must be called before use.
   SendSocket() {}
   // Calls Connect automatically.
diff --git a/aos/common/network/Socket.cpp b/aos/common/network/Socket.cpp
index 1ffc775..0366e7c 100644
--- a/aos/common/network/Socket.cpp
+++ b/aos/common/network/Socket.cpp
@@ -32,7 +32,9 @@
 
   return last_ret_ = 0;
 }
+
 Socket::Socket() : socket_(-1), last_ret_(2) {}
+
 Socket::~Socket() {
   close(socket_);
 }
@@ -45,28 +47,31 @@
   last_ret_ = 0;
 }
 
-int Socket::Recv(void *buf, int length) {
+int Socket::Receive(void *buf, int length) {
   const int ret = recv(socket_, static_cast<char *>(buf), length, 0);
   last_ret_ = (ret == -1) ? -1 : 0;
   return ret;
 }
-int Socket::Recv(void *buf, int length, long usec) {
-	timeval tv;
-	tv.tv_sec = 0;
-	tv.tv_usec = usec;
-	fd_set fds;
-	FD_ZERO(&fds);
-	FD_SET(socket_, &fds);
-	switch (select(FD_SETSIZE, &fds, NULL, NULL, &tv)) {
-		case 1:
-      return Recv(buf, length);
-		case 0:
-			return last_ret_ = 0;
-		default:
-			perror("select on socket to receive from failed");
-			return last_ret_ = -1;
-	}
+
+int Socket::Receive(void *buf, int length, time::Time timeout) {
+  timeval timeout_timeval = timeout.ToTimeval();
+  fd_set fds;
+  FD_ZERO(&fds);
+  FD_SET(socket_, &fds);
+  switch (select(FD_SETSIZE, &fds, NULL, NULL, &timeout_timeval)) {
+    case 1:
+      return Receive(buf, length);
+    case 0:
+      return last_ret_ = 0;
+    default:
+      if (errno == EINTR) {
+        return last_ret_ = 0;
+      }
+      LOG(FATAL, "select(FD_SETSIZE, %p, NULL, NULL, %p) failed with %d: %s\n",
+          &fds, &timeout_timeval, errno, strerror(errno));
+  }
 }
+
 int Socket::Send(const void *buf, int length) {
   const int ret = write(socket_,
                         lame_unconst(static_cast<const char *>(buf)), length);
diff --git a/aos/common/network/Socket.h b/aos/common/network/Socket.h
index b6d2c70..68fd32c 100644
--- a/aos/common/network/Socket.h
+++ b/aos/common/network/Socket.h
@@ -18,9 +18,21 @@
  public:
   int LastStatus() const { return last_ret_; }
 
-	int Send(const void *buf, int length);
-	int Recv(void *buf, int length);
-	int Recv(void *buf, int length, long usec); // returns 0 if timed out
+  int Send(const void *buf, int length);
+
+  // buf is where to put the data and length is the maximum amount of data to
+  // put in for all overloads.
+  // All overloads return how many bytes were received or -1 for error. 0 is a
+  // valid return value for all overloads.
+  // No timeout.
+  int Receive(void *buf, int length);
+  // DEPRECATED(brians): use the time::Time overload instead
+  int Receive(void *buf, int length, long usec_timeout) {
+    return Receive(buf, length, time::Time::InUS(usec_timeout));
+  }
+  // timeout is relative
+  int Receive(void *buf, int length, time::Time timeout);
+
  protected:
   int Connect(NetworkPort port, const char *address, int type = SOCK_DGRAM);
   Socket();