Article View: comp.unix.programmer
Article #81Re: sleep for less than 1 second?
From: hagar
Date: Sat, 18 Jul 1992 11:59
Date: Sat, 18 Jul 1992 11:59
60 lines
2006 bytes
2006 bytes
john@jwt.UUCP (John Temples) writes:
>In article <1305@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes:
>>On recent SysV-s you may also find `napms()' as part of the curses library
>I have this on my SVR3.2 system, but it doesn't work. It always
>returns immediately, regardless of the requested sleep time.
From ISC's (SVR3.2) man page of curses:
BUGS
[ ... ]
The argument to napms() is currently rounded up to the
nearest second.
[ ... ]
Rev. Extended Terminal Interface Page 40
Maybe napms() does not round it up on your system, but down?
Who knows? Who cares?
Use poll(2)!
Here is an example:
---------------------------------------------------------------------------
/*
* sleep_ms(timeout) - sleep for timeout milliseconds (USG)
*/
#include <poll.h>
int
sleep_ms(timeout)
int timeout;
{
struct pollfd dummy[1];
return(poll(dummy, 0L, timeout));
}
---------------------------------------------------------------------------
Sorry. It's no code of mine, but I forgot where I got this
from. So I'm not able to name the guy who wrote this...
cu
hag
--
Oliver Fink, Baumweg 46, 2300 Kiel 1, Germany +49 431 682423
-------------------------------------------------------------------------------
Es gibt 1000 gute Gruende, auf dieses Land stolz zu sein; Tote
warum faellt uns jetzt auf einmal kein einziger mehr ein!? Hosen
Technical Details
Message-ID:
<1992Jul18.015947.2383@hagki.topp>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!hagki.toppoint.de!hagarReferences:
<1992Jul8.172645.8445@uoft02.utol>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!hagki.toppoint.de!hagar From: hagar@hagki.toppoint.de Newsgroups: comp.unix.programmer Date: 18 Jul 92 05:59 MDT Subject: Re: sleep for less than 1 second? Sender: Notesfile to Usenet Gateway <notes@glas.apc.org> Message-ID: <1992Jul18.015947.2383@hagki.topp> References: <1992Jul8.172645.8445@uoft02.utol> Nf-ID: #R:1992Jul8.172645.8445@uoft02.utol:-1438768942:1992Jul18.015947.2383@hagki.topp:-1952476607:001:1397 Nf-From: hagki.toppoint.de!hagar Jul 18 05:59:00 1992 Lines: 61