Message-ID: <3AC356EE.3010201@ujf-grenoble.fr> Date: Thu, 29 Mar 2001 17:38:22 +0200 From: Maurice Lombardi User-Agent: Mozilla/5.0 (Windows; U; Win98; fr-FR; m18) Gecko/20010131 Netscape6/6.01 X-Accept-Language: fr,it,en MIME-Version: 1.0 To: Eli Zaretskii CC: djgpp AT delorie DOT com, gpc Subject: Re: Bug in Delay References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > On Thu, 29 Mar 2001, Maurice Lombardi wrote: > > >>> What I'm wondering is, if DJGPP's libc contains a delay() function >>> which does handle short delays well (and even seems to use >>> microseconds internally AFAICS), why doesn't its usleep() function >>> do the same thing? >> > > If both functions used the same service, you couldn't have chosen one or > the other, depending on your needs. Having both is better than only one. > > Why is it a problem that they use different methods? The docs clearly > says what service is used, so the information is available, isn't it? The question has been raised by an user of GNU pascal (gpc) who found a difference between delay() in C and delay() in gpc. gpc beeing all platforms, not limited to djgpp, has implemented a delay() function by using usleep(), which, while being neither ANSI nor POSIX, is available on many platforms: prototype in unistd.h which exists e.g. on linux. The djgpp C delay() function is a dosish nicety (prototype in dos.h) which exists nowhere else. It is unfortunate that djgpp implemented the less accurate delay function with the more standard usleep() function. But probably gpc maintainers will cope with this ... Maurice -- Maurice Lombardi Laboratoire de Spectrometrie Physique, Universite Joseph Fourier de Grenoble, BP87 38402 Saint Martin d'Heres Cedex FRANCE Tel: 33 (0)4 76 51 47 51 Fax: 33 (0)4 76 51 45 44 mailto:Maurice DOT Lombardi AT ujf-grenoble DOT fr