46 #include <sys/types.h>
73 struct timespec mrqtp;
74 mrqtp.tv_sec = iTimeVal;
77 return nanosleep(&mrqtp, NULL);
79 return sleep(iTimeVal);
91 struct timespec mrqtp;
92 mrqtp.tv_sec = iTimeVal/1000000;
93 mrqtp.tv_nsec = (iTimeVal - (mrqtp.tv_sec * 1000000)) * 1000;
95 return nanosleep(&mrqtp, NULL);
98 tv.tv_sec = iTimeVal/1000000;
99 tv.tv_usec = iTimeVal - (tv.tv_sec * 1000000);
100 return select(0, NULL, NULL, NULL, &tv);
104 INTERNAL
int SYS_RandomInt(
int fStart,
int fEnd)
106 static int iInitialized = 0;
109 if (0 == iInitialized)
111 srand(SYS_GetSeed());
119 iRandNum = ((rand()+0.0)/RAND_MAX * (fEnd - fStart)) + fStart;
124 INTERNAL
int SYS_GetSeed(
void)
130 tz.tz_minuteswest = 0;
132 if (gettimeofday(&tv, &tz) == 0)
137 myseed = (long) time(NULL);
This handles abstract system level calls.
INTERNAL int SYS_Sleep(int iTimeVal)
Makes the current process sleep for some seconds.
INTERNAL int SYS_USleep(int iTimeVal)
Makes the current process sleep for some microseconds.