Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc05!hpyhde4!hpycla!hpcuhc!hpcupt3!ken From: ken@hpcupt3.cup.hp.com (Kenneth M. Sumrall) Newsgroups: comp.sys.hp Subject: Re: usleep [Re: BSD and HPUX, The Questions Continue...] Message-ID: <48580031@hpcupt3.cup.hp.com> Date: 22 May 91 20:51:37 GMT References: <2130012@aspen.IAG.HP.COM> Organization: Hewlett Packard, Cupertino Lines: 30 >Sure they can, they just can't be linked. (Sorry, I'm just trying to >live up to my snide reputation.) Here's a version of usleep I use: > >#include > >usleep (usecs) >long usecs; >{ > struct timeval timeout; > > timeout.tv_sec = 0; /* should be usecs / 1000000 */ ^^^^^^^^^^^^^^^^^^^^^^^^^ > timeout.tv_usec = usecs; /* should be usecs % 1000000 */ ^^^^^^^^^^^^^^^^^^^^^^^^^ > select(0, 0, 0, 0, &timeout); >} > Believe the two comments above. If tv_usec is more than 1,000,000, and tv_sec is zero, their is no delay at all. This is the behaviour I noticed two releases ago when I was porting some code. Of course, things could have changed, but why risk it? Hope this helps. > -- Chan Benson > HP Fort Collins | Ken Sumrall | Internet: ken%hpda@hplabs.hp.com | | HP California Language Labs | UUCP: ...!hplabs!hpda!ken | | "I'd stomp desert dope heads for some gas in my moped!" - Bill the Cat | | "What a stupid world" -Calvin (speaking to Hobbes) |