]> git.sur5r.net Git - cc65/commitdiff
Added sleep.c from Stefan Haubenthal
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 12 Jun 2003 08:28:54 +0000 (08:28 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 12 Jun 2003 08:28:54 +0000 (08:28 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2209 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/.cvsignore
libsrc/common/Makefile
libsrc/common/sleep.c [new file with mode: 0644]

index 6038dd9e4693e7a5c122c0a5455f97ae5ccb87f7..76d1d0b75761d1f35e85f08a2446832831635ece 100644 (file)
@@ -29,6 +29,7 @@ puts.s
 qsort.s
 realloc.s
 rewind.s
+sleep.s
 sscanf.s
 strftime.s
 strtok.s
index 52b460c884858d6891683294599fea78e1c02155..273dec7dcf40ff6dbbe10e950376cab43563ff6a 100644 (file)
@@ -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 (file)
index 0000000..cbff4fb
--- /dev/null
@@ -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;
+}
+
+
+