跨平台(WIndows, Linux, VxWorks) getTickCount实现
#ifdef WIN32
#define OS_WINDOWS WIN32
#include <windows.h>
#endif
#ifdef LINUX
#include <unistd.h>
#include <sys/time.h>
#include <netinet/in.h>
#endif
#ifdef VXWORKS
#include "vxworks.h"
#include <tickLib.h>
#include <sysLib.h>
#endif
#define ULONAG unsigned long
ULONGA getTickCount(void)
{
ULONGA currentTime;
#ifdef WIN32
currentTime = GetTickCount();
#endif
#ifdef LINUX
struct timeval current;
gettimeofday(¤t, NULL);
currentTime = current.tv_sec * 1000 + current.tv_usec/1000;
#endif
#ifdef OS_VXWORKS
ULONGA timeSecond = tickGet() / sysClkRateGet();
ULONGA timeMilsec = tickGet() % sysClkRateGet() * 1000 / sysClkRateGet();
currentTime = timeSecond * 1000 + timeMilsec;
#endif
return currentTime;
}