www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000168

When Created: 07/24/1997 14:12:43
Against DJGPP version: 2.01
By whom: mvanderl@msn.com
Abstract: usleep doesn't work with values below 11264
#include <unistd.h>

main()
{
   int loop;

   for (loop=0; loop<=20; loop++) {
      printf("%10d\n",loop); // These print with a delay
      usleep(11264); 
   }

   printf("%s\n","----------------------------------");

   for (loop=0; loop<=20; loop++) {
      printf("%10d\n",loop); // These print with no delay!!!!
      usleep(11263); 
   }
}






}

Note added: 04/13/1999 12:00:54
By whom: eliz@is.elta.co.il
This is not a bug: `usleep' uses `clock' internally, and so has only
55-msec granularity.  Since `clock' reports the timer tick count with
a scale factor of 5, any argument to `usleep' that is less than 11 msec
will result in no sleep at all, and anything less than 55 msec will
sometimes sleep for 55 msec and sometimes for less.

A note in this spirit wass added in WIP and will be in v2.03.

Closed on 04/13/1999 12:00:32: This is a limitation of the PC clock, not a bug.
By whom: eliz@is.elta.co.il



  webmaster     delorie software   privacy  
  Copyright © 2010   by DJ Delorie     Updated Jul 2010