aboutsummaryrefslogtreecommitdiffstats
path: root/missing_d/usleep.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:55:10 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:55:10 +0300
commit00ef0423acd97cb964a2bae54c93a03a8ab50e5e (patch)
tree2864426773f537f912db1bd716c27b713c5f7dcf /missing_d/usleep.c
parent3ba50a15ebd976f7a88393e2e45dc14b6478b9a9 (diff)
downloadegawk-00ef0423acd97cb964a2bae54c93a03a8ab50e5e.tar.gz
egawk-00ef0423acd97cb964a2bae54c93a03a8ab50e5e.tar.bz2
egawk-00ef0423acd97cb964a2bae54c93a03a8ab50e5e.zip
Move to 3.1.8.
Diffstat (limited to 'missing_d/usleep.c')
-rw-r--r--missing_d/usleep.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/missing_d/usleep.c b/missing_d/usleep.c
new file mode 100644
index 00000000..cb1c7abf
--- /dev/null
+++ b/missing_d/usleep.c
@@ -0,0 +1,17 @@
+/*
+ * usleep - round microseconds up to an integral number of seconds.
+ *
+ * The real usleep() doesn't work this way; this is a hack for systems
+ * that don't have usleep().
+ */
+
+int
+usleep(unsigned int usec)
+{
+ unsigned int seconds = usec / 1000000;
+
+ /* Round up: */
+ seconds += (usec % 1000000 > 0); /* 1 or 0 */
+
+ return sleep(seconds);
+}