]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd_win32wrapper.cpp
Fixed Windows build on VS 2010
[user/henk/code/inspircd.git] / win / inspircd_win32wrapper.cpp
index d82c90a61be9d6a99f380e507d01e03e25afdc99..88ea338c66f02b586f64f677a9502bf7ea5603ea 100644 (file)
@@ -238,7 +238,7 @@ int printf_c(const char * format, ...)
 
 int optind = 1;
 char optarg[514];
-int getopt_long_only(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
+int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
 {
        // burlex todo: handle the shortops, at the moment it only works with longopts.
 
@@ -556,7 +556,7 @@ int clock_gettime(int clock, struct timespec * tv)
 
        DWORD mstime = timeGetTime();
        tv->tv_sec   = time(NULL);
-       tv->tv_usec  = (mstime - (tv->tv_sec * 1000)) * 1000000;
+       tv->tv_nsec  = (mstime - (tv->tv_sec * 1000)) * 1000000;
        return 0;       
 }
 
@@ -696,3 +696,49 @@ int getcpu()
 
        return cpu;
 }
+
+int random()
+{
+       return rand();
+}
+
+void srandom(unsigned int seed)
+{
+       srand(seed);
+}
+
+int gettimeofday(timeval *tv, void *)
+{
+       SYSTEMTIME st;
+       GetSystemTime(&st);
+
+       tv->tv_sec = ServerInstance->Time();
+       tv->tv_usec = st.wMilliseconds;
+
+       return 0;
+}
+
+/* World's largest hack to make m_spanningtree work */
+#include "../src/modules/m_spanningtree/link.h"
+static void unused_Function()
+{
+       reference<Link> unused_Link;
+       reference<Autoconnect> unused_Autoconnect;
+
+       if (unused_Link)
+               unused_Link->Port = -1;
+       if (unused_Autoconnect)
+               unused_Autoconnect->NextConnectTime = -1;
+
+       Autoconnect *a = unused_Autoconnect;
+       Link *l = unused_Link;
+
+       unused_Link = reference<Link>(unused_Link);
+       unused_Autoconnect = reference<Autoconnect>(unused_Autoconnect);
+
+       unused_Link = reference<Link>(l);
+       unused_Autoconnect = reference<Autoconnect>(a);
+
+       delete unused_Link;
+       delete unused_Autoconnect;
+}