43 #include <sys/types.h>
70 struct timespec mrqtp;
71 mrqtp.tv_sec = iTimeVal;
74 return nanosleep(&mrqtp, NULL);
76 return sleep(iTimeVal);
88 struct timespec mrqtp;
89 mrqtp.tv_sec = iTimeVal/1000000;
90 mrqtp.tv_nsec = (iTimeVal - (mrqtp.tv_sec * 1000000)) * 1000;
92 return nanosleep(&mrqtp, NULL);
95 tv.tv_sec = iTimeVal/1000000;
96 tv.tv_usec = iTimeVal - (tv.tv_sec * 1000000);
97 return select(0, NULL, NULL, NULL, &tv);
101 INTERNAL
int SYS_RandomInt(
int fStart,
int fEnd)
103 static int iInitialized = 0;
106 if (0 == iInitialized)
108 srand(SYS_GetSeed());
116 iRandNum = ((rand()+0.0)/RAND_MAX * (fEnd - fStart)) + fStart;
121 INTERNAL
int SYS_GetSeed(
void)
127 tz.tz_minuteswest = 0;
129 if (gettimeofday(&tv, &tz) == 0)
134 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.