summaryrefslogtreecommitdiff
path: root/win/inspircd_win32wrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'win/inspircd_win32wrapper.cpp')
-rw-r--r--win/inspircd_win32wrapper.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp
index d82c90a61..88ea338c6 100644
--- a/win/inspircd_win32wrapper.cpp
+++ b/win/inspircd_win32wrapper.cpp
@@ -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;
+}