30 #include <sys/timeb.h> 73 _ftime_s(&currSysTime);
75 dTime = (currSysTime.time + ((double)currSysTime.millitm) / 1000.0);
79 if(gettimeofday(&now, (
struct timezone *)0))
return 0.0;
81 dTime = ((double)now.tv_sec) + ((double)(now.tv_usec) / 1000000.0);
89 double dAbsTime = 0.0;
94 _ftime_s(&currSysTime);
96 dAbsTime = (currSysTime.time + ((double)currSysTime.millitm) / 1000.0);
100 if(gettimeofday(&now, (
struct timezone *)0))
return 0.0;
102 dAbsTime = ((double)now.tv_sec) + ((double)(now.tv_usec) / 1000000.0);
111 ::Sleep((
unsigned long)(dTime * 1000.0));
113 ::usleep((
unsigned long)(dTime * 1000000.0));
122 ::usleep(nTimeMS * 1000);
129 double dTimeDiff = dAbsTime - clock.
GetTime();
132 if(dTimeDiff > 4000000.0) dTimeDiff = 4000000.0;
134 if(dTimeDiff >= 4000.0) dTimeDiff = 4000.0;
136 while(dTimeDiff > 0.0)
139 dTimeDiff = dAbsTime - clock.
GetTime();
141 if(dTimeDiff > 4000000.0) dTimeDiff = 4000000.0;
143 if(dTimeDiff >= 4000.0) dTimeDiff = 4000.0;
static void SleepMS(unsigned long nTimeMS)
static void SleepAbs(double dAbsTime)
virtual double GetTime() const
static double GetAbsTime()
static void Sleep(double dTime)
virtual void SetStartTime()