some fixes to make compiling on some bsd easier
authorPerttu Ahola <celeron55@gmail.com>
Fri, 11 Feb 2011 20:34:34 +0000 (22:34 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Fri, 11 Feb 2011 20:34:34 +0000 (22:34 +0200)
src/map.h
src/porting.h
src/socket.h

index e93ba2cd354c390f8c291afbe4f1bb2b1aa941df..60cfd698b76c2f686368d4617f57e5798cf9fcc4 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <jmutex.h>
 #include <jthread.h>
 #include <iostream>
-#include <malloc.h>
 
 #ifdef _WIN32
        #include <windows.h>
index 441a57d779b5bd43f1d45cf44db0f986de17a1a5..3133fcc804e275b6fb81b21e88b72b092dc18932 100644 (file)
@@ -86,13 +86,20 @@ void initializePaths();
                return GetTickCount();
        }
 #else // Posix
-       #include <sys/timeb.h>
+       #include <sys/time.h>
+       inline u32 getTimeMs()
+       {
+               struct timeval tv;
+               gettimeofday(&tv, NULL);
+               return tv.tv_sec * 1000 + tv.tv_usec / 1000;
+       }
+       /*#include <sys/timeb.h>
        inline u32 getTimeMs()
        {
                struct timeb tb;
                ftime(&tb);
                return tb.time * 1000 + tb.millitm;
-       }
+       }*/
 #endif
 
 } // namespace porting
index 6b7a2462ee61ce2d696843978b99a9edf175968c..c2b496e9ed3afffd4dde041a56e68766400a61c3 100644 (file)
@@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 typedef SOCKET socket_t;
 typedef int socklen_t;
 #else
+       #include <sys/types.h>
        #include <sys/socket.h>
        #include <netinet/in.h>
        #include <fcntl.h>