Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpcuhb!hpindda!burdick From: burdick@hpindda.HP.COM (Matt Burdick) Newsgroups: alt.sources Subject: Re: "usleep" C routine for HP's Message-ID: <5110003@hpindda.HP.COM> Date: 2 May 89 15:51:13 GMT References: <23352@shemp.CS.UCLA.EDU> Organization: HP Information Networks, Cupertino, CA Lines: 28 > 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 #include 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@hplabs.hp.com | Technical Communications Lab