some fixes to make compiling on some bsd easier

This commit is contained in:
Perttu Ahola 2011-02-11 22:34:34 +02:00
parent dad2455a03
commit cabe6f1d65
3 changed files with 10 additions and 3 deletions

@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <jmutex.h> #include <jmutex.h>
#include <jthread.h> #include <jthread.h>
#include <iostream> #include <iostream>
#include <malloc.h>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>

@ -86,13 +86,20 @@ void initializePaths();
return GetTickCount(); return GetTickCount();
} }
#else // Posix #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() inline u32 getTimeMs()
{ {
struct timeb tb; struct timeb tb;
ftime(&tb); ftime(&tb);
return tb.time * 1000 + tb.millitm; return tb.time * 1000 + tb.millitm;
} }*/
#endif #endif
} // namespace porting } // namespace porting

@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
typedef SOCKET socket_t; typedef SOCKET socket_t;
typedef int socklen_t; typedef int socklen_t;
#else #else
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <fcntl.h> #include <fcntl.h>