mirror of
https://github.com/cc65/cc65.git
synced 2025-05-02 21:38:21 +00:00
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:
parent
bd4702cb97
commit
d8449e18cd
@ -29,6 +29,7 @@ puts.s
|
|||||||
qsort.s
|
qsort.s
|
||||||
realloc.s
|
realloc.s
|
||||||
rewind.s
|
rewind.s
|
||||||
|
sleep.s
|
||||||
sscanf.s
|
sscanf.s
|
||||||
strftime.s
|
strftime.s
|
||||||
strtok.s
|
strtok.s
|
||||||
|
@ -47,6 +47,7 @@ C_OBJS = _afailed.o \
|
|||||||
qsort.o \
|
qsort.o \
|
||||||
realloc.o \
|
realloc.o \
|
||||||
rewind.o \
|
rewind.o \
|
||||||
|
sleep.o \
|
||||||
sscanf.o \
|
sscanf.o \
|
||||||
strftime.o \
|
strftime.o \
|
||||||
strxfrm.o \
|
strxfrm.o \
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user