From: cuz Date: Thu, 12 Jun 2003 08:28:54 +0000 (+0000) Subject: Added sleep.c from Stefan Haubenthal X-Git-Tag: V2.12.0~1509 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d8449e18cdac2227f66f2f76e030bdf9ecf6ebf9;p=cc65 Added sleep.c from Stefan Haubenthal git-svn-id: svn://svn.cc65.org/cc65/trunk@2209 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/common/.cvsignore b/libsrc/common/.cvsignore index 6038dd9e4..76d1d0b75 100644 --- a/libsrc/common/.cvsignore +++ b/libsrc/common/.cvsignore @@ -29,6 +29,7 @@ puts.s qsort.s realloc.s rewind.s +sleep.s sscanf.s strftime.s strtok.s diff --git a/libsrc/common/Makefile b/libsrc/common/Makefile index 52b460c88..273dec7dc 100644 --- a/libsrc/common/Makefile +++ b/libsrc/common/Makefile @@ -47,6 +47,7 @@ C_OBJS = _afailed.o \ qsort.o \ realloc.o \ rewind.o \ + sleep.o \ sscanf.o \ strftime.o \ strxfrm.o \ diff --git a/libsrc/common/sleep.c b/libsrc/common/sleep.c new file mode 100644 index 000000000..cbff4fbff --- /dev/null +++ b/libsrc/common/sleep.c @@ -0,0 +1,23 @@ +/* + * sleep.c + * + * Stefan Haubenthal, 2003-06-11 + * Ullrich von Bassewitz, 2003-06-12 + * + */ + + + +#include + + + +unsigned sleep (unsigned wait) +{ + clock_t goal = clock () + ((clock_t) wait) * CLOCKS_PER_SEC; + while ((long) (goal - clock ()) > 0) ; + return 0; +} + + +