From d8449e18cdac2227f66f2f76e030bdf9ecf6ebf9 Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 12 Jun 2003 08:28:54 +0000 Subject: [PATCH] Added sleep.c from Stefan Haubenthal git-svn-id: svn://svn.cc65.org/cc65/trunk@2209 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/common/.cvsignore | 1 + libsrc/common/Makefile | 1 + libsrc/common/sleep.c | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 libsrc/common/sleep.c 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; +} + + + -- 2.39.5