diff src/cutils.c @ 3317:092399af4e5d

[project @ 1999-10-22 01:13:44 by jwe]
author jwe
date Fri, 22 Oct 1999 01:13:45 +0000
parents 48872c196664
children f38b5d63d02d
line wrap: on
line diff
--- a/src/cutils.c
+++ b/src/cutils.c
@@ -39,8 +39,8 @@
 #include <sys/poll.h>
 #endif
 
-void
-octave_usleep (unsigned int useconds)
+static void
+do_octave_usleep (unsigned int useconds)
 {
 #if defined (HAVE_USLEEP)
 
@@ -60,14 +60,24 @@
   struct pollfd pfd;
   int delay = useconds / 1000;
 
-  if (delay <= 0)
-    delay = 1;
-
-  poll (&fd, 0, delay);
+  if (delay > 0)
+    poll (&fd, 0, delay);
 
 #endif
 }
 
+void
+octave_usleep (unsigned int useconds)
+{
+  unsigned int sec = useconds / 1000000;
+  unsigned int usec = useconds % 1000000;
+
+  if (sec > 0)
+    sleep (sec);
+
+  do_usleep (usec);
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***