41 #include <sys/types.h> 68 struct timespec mrqtp;
69 mrqtp.tv_sec = iTimeVal;
72 return nanosleep(&mrqtp, NULL);
74 return sleep(iTimeVal);
86 struct timespec mrqtp;
87 mrqtp.tv_sec = iTimeVal/1000000;
88 mrqtp.tv_nsec = (iTimeVal - (mrqtp.tv_sec * 1000000)) * 1000;
90 return nanosleep(&mrqtp, NULL);
93 tv.tv_sec = iTimeVal/1000000;
94 tv.tv_usec = iTimeVal - (tv.tv_sec * 1000000);
95 return select(0, NULL, NULL, NULL, &tv);
99 INTERNAL
int SYS_RandomInt(
int fStart,
int fEnd)
101 static int iInitialized = 0;
104 if (0 == iInitialized)
106 srand(SYS_GetSeed());
114 iRandNum = ((rand()+0.0)/RAND_MAX * (fEnd - fStart)) + fStart;
119 INTERNAL
int SYS_GetSeed(
void)
125 tz.tz_minuteswest = 0;
127 if (gettimeofday(&tv, &tz) == 0)
132 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.