"usleep" C routine for HP's

Matt Burdick burdick at hpindda.HP.COM
Wed May 3 01:51:13 AEST 1989


> Does anybody know about any "nap" or "usleep" routine that would 
> work in a HP machine with a precision of tenths-of-a-second at least?
> The operating system is BSD4.3. 

Try this:

------------------------------------
#include <sys/types.h>
#include <sys/time.h>

usleep(usecs)
        u_long usecs;
{
        struct timeval tv;

        tv.tv_sec = usecs / 1000000L;
        tv.tv_usec = usecs % 1000000L;
        (void)select(0, 0, 0, 0, &tv);
}

------------------------------------

By the way, this was not written by me, I just grabbed it from another HP
machine.

-- 
Matt Burdick			| Hewlett-Packard
burdick%hpda at hplabs.hp.com	| Technical Communications Lab



More information about the Alt.sources mailing list