]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
skypiax: compiles on windows
authorGiovanni Maruzzelli <gmaruzz@gmail.com>
Fri, 24 Jul 2009 14:03:23 +0000 (14:03 +0000)
committerGiovanni Maruzzelli <gmaruzz@gmail.com>
Fri, 24 Jul 2009 14:03:23 +0000 (14:03 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14341 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_skypiax/skypiax.h
src/mod/endpoints/mod_skypiax/skypiax_protocol.c

index c1f5003165818120964107ba8f668c326d38da42..6fd1f681805125f1f3c114d511eec3146abff5a9 100644 (file)
 
 #include <switch.h>
 #include <switch_version.h>
-#include <sys/time.h>
+
 
 #ifndef WIN32
+#include <sys/time.h>
 #include <X11/Xlib.h>
 #include <X11/Xlibint.h>
 #include <X11/Xatom.h>
 //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
index e16c798f6f5f39f3f7e230cdbfb4f60f26f2bfd2..cc2a2b6b53044e2cfcc5e4ce9f8dca14fa1d3f29 100644 (file)
@@ -181,7 +181,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
               /* this is the call in which we are calling out */
               DEBUGA_SKYPE("Call %s NOTHING\n", SKYPIAX_P_LOG, id);
             } else {
-              usleep(400000);   //0.4 seconds
+              skypiax_sleep(400000);   //0.4 seconds
               DEBUGA_SKYPE("Call %s TRY TRANSFER\n", SKYPIAX_P_LOG, id);
               skypiax_transfer(tech_pvt, id, value);
             }