#include "skypiax.h"
+#ifdef WIN32
+/***************/
+// from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
+
+#include <time.h>\r
+ \r
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)\r
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64\r
+#else\r
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL\r
+#endif\r
+ \r
+ struct timezone \r
+ {\r
+ int tz_minuteswest; /* minutes W of Greenwich */\r
+ int tz_dsttime; /* type of dst correction */\r
+ };\r
+ \r
+ int gettimeofday(struct timeval *tv, struct timezone *tz)\r
+ {\r
+ FILETIME ft;\r
+ unsigned __int64 tmpres = 0;\r
+ static int tzflag;\r
+ \r
+ if (NULL != tv)\r
+ {\r
+ GetSystemTimeAsFileTime(&ft);\r
+ \r
+ tmpres |= ft.dwHighDateTime;\r
+ tmpres <<= 32;\r
+ tmpres |= ft.dwLowDateTime;\r
+ \r
+ /*converting file time to unix epoch*/\r
+ tmpres /= 10; /*convert into microseconds*/\r
+ tmpres -= DELTA_EPOCH_IN_MICROSECS; \r
+ tv->tv_sec = (long)(tmpres / 1000000UL);\r
+ tv->tv_usec = (long)(tmpres % 1000000UL);\r
+ }\r
+ \r
+ if (NULL != tz)\r
+ {\r
+ if (!tzflag)\r
+ {\r
+ _tzset();\r
+ tzflag++;\r
+ }\r
+ tz->tz_minuteswest = _timezone / 60;\r
+ tz->tz_dsttime = _daylight;\r
+ }\r
+ \r
+ return 0;\r
+ }\r
+/***************/
+#endif /* WIN32 */
+
SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown);
SWITCH_MODULE_DEFINITION(mod_skypiax, mod_skypiax_load, mod_skypiax_shutdown, NULL);
//Windows macro for FD_SET includes a warning C4127: conditional expression is constant
#pragma warning(push)
#pragma warning(disable:4127)
-
-/***************/
-// from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
-
-#include <time.h>\r
- \r
-#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)\r
-#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64\r
-#else\r
-#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL\r
-#endif\r
- \r
- struct timezone \r
- {\r
- int tz_minuteswest; /* minutes W of Greenwich */\r
- int tz_dsttime; /* type of dst correction */\r
- };\r
- \r
- int gettimeofday(struct timeval *tv, struct timezone *tz)\r
- {\r
- FILETIME ft;\r
- unsigned __int64 tmpres = 0;\r
- static int tzflag;\r
- \r
- if (NULL != tv)\r
- {\r
- GetSystemTimeAsFileTime(&ft);\r
- \r
- tmpres |= ft.dwHighDateTime;\r
- tmpres <<= 32;\r
- tmpres |= ft.dwLowDateTime;\r
- \r
- /*converting file time to unix epoch*/\r
- tmpres /= 10; /*convert into microseconds*/\r
- tmpres -= DELTA_EPOCH_IN_MICROSECS; \r
- tv->tv_sec = (long)(tmpres / 1000000UL);\r
- tv->tv_usec = (long)(tmpres % 1000000UL);\r
- }\r
- \r
- if (NULL != tz)\r
- {\r
- if (!tzflag)\r
- {\r
- _tzset();\r
- tzflag++;\r
- }\r
- tz->tz_minuteswest = _timezone / 60;\r
- tz->tz_dsttime = _daylight;\r
- }\r
- \r
- return 0;\r
- }\r
-/***************/
-
#endif
#define SAMPLERATE_SKYPIAX 16000