2003-06-12 08:28:54 +00:00
|
|
|
/*
|
2014-06-30 09:10:35 +00:00
|
|
|
** sleep.c
|
|
|
|
**
|
|
|
|
** Stefan Haubenthal, 2003-06-11
|
|
|
|
** Ullrich von Bassewitz, 2003-06-12
|
|
|
|
**
|
|
|
|
*/
|
2003-06-12 08:28:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2003-06-12 18:17:46 +00:00
|
|
|
#include <time.h>
|
2003-06-12 18:08:23 +00:00
|
|
|
#include <unistd.h>
|
2003-06-12 08:28:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2003-06-12 18:17:46 +00:00
|
|
|
/* We cannot implement this function without a working clock function */
|
|
|
|
#if defined(CLOCKS_PER_SEC)
|
2003-06-12 09:13:35 +00:00
|
|
|
unsigned __fastcall__ sleep (unsigned wait)
|
2003-06-12 08:28:54 +00:00
|
|
|
{
|
|
|
|
clock_t goal = clock () + ((clock_t) wait) * CLOCKS_PER_SEC;
|
|
|
|
while ((long) (goal - clock ()) > 0) ;
|
|
|
|
return 0;
|
|
|
|
}
|
2003-06-12 18:17:46 +00:00
|
|
|
#endif
|
2003-06-12 08:28:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|