Merge of trunk into branch 1.6.x.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@339 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2008-03-25 10:21:08 +00:00
parent 1c9632dcc3
commit 4b40e94b03
46 changed files with 2964 additions and 334 deletions

View File

@@ -79,7 +79,20 @@ typedef enum priority {LOW_PRIORITY,
#endif
#include "LinkedList.h"
#include <sys/time.h> /* for gettimeofday() */
#ifdef WIN32
#include <time.h>
#include <winsock2.h>
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
int gettimeofday(struct timeval *tv, struct timezone *tz);
#else /* WIN32 */
#include <sys/time.h> /* for gettimeofday() */
#endif
#include "FreeList.h"
#include "ithread.h"

View File

@@ -715,7 +715,11 @@ typedef pthread_rwlock_t ithread_rwlock_t;
* 0 on success, Nonzero on failure.
* See man page for sleep (man 3 sleep)
*****************************************************************************/
#ifndef WIN32
#define isleep sleep
#else
#define isleep(x) Sleep((x)*1000)
#endif
/****************************************************************************
* Function: isleep
@@ -730,7 +734,11 @@ typedef pthread_rwlock_t ithread_rwlock_t;
* 0 on success, Nonzero on failure.
* See man page for sleep (man 3 sleep)
*****************************************************************************/
#ifndef WIN32
#define imillisleep(x) usleep(1000*x)
#else
#define imillisleep Sleep
#endif
#ifdef WIN32
#ifndef UPNP_STATIC_LIB

View File

@@ -30,11 +30,13 @@
///////////////////////////////////////////////////////////////////////////
#include "LinkedList.h"
#include <sys/param.h>
#ifndef WIN32
#include <sys/param.h>
#endif
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__)
#include <stdlib.h>
#include <stdlib.h>
#else
#include <malloc.h>
#include <malloc.h>
#endif
#include <assert.h>
@@ -532,3 +534,4 @@ ListSize( LinkedList * list )
return list->size;
}

View File

@@ -1597,3 +1597,45 @@ int ThreadPoolGetStats( ThreadPool *tp, ThreadPoolStats *stats )
#endif /* STATS */
#ifdef WIN32
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
int gettimeofday(struct timeval *tv, struct timezone *tz)
{
FILETIME ft;
unsigned __int64 tmpres = 0;
static int tzflag;
if (NULL != tv)
{
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime;
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
/*converting file time to unix epoch*/
tmpres /= 10; /*convert into microseconds*/
tmpres -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long)(tmpres / 1000000UL);
tv->tv_usec = (long)(tmpres % 1000000UL);
}
if (NULL != tz)
{
if (!tzflag)
{
_tzset();
tzflag++;
}
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
return 0;
}
#endif /* WIN32 */