Added sleep.c from Stefan Haubenthal
git-svn-id: svn://svn.cc65.org/cc65/trunk@2209 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
23
libsrc/common/sleep.c
Normal file
23
libsrc/common/sleep.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* sleep.c
|
||||
*
|
||||
* Stefan Haubenthal, 2003-06-11
|
||||
* Ullrich von Bassewitz, 2003-06-12
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
unsigned sleep (unsigned wait)
|
||||
{
|
||||
clock_t goal = clock () + ((clock_t) wait) * CLOCKS_PER_SEC;
|
||||
while ((long) (goal - clock ()) > 0) ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user