Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!haven!decuac!e2big.mko.dec.com!bacchus.pa.dec.com!decwrl!uunet!mmlai!burzio From: burzio@mmlai.UUCP (Tony Burzio) Newsgroups: comp.unix.questions Subject: Re: Millisecond clock Keywords: HP-UX SYSV Message-ID: <14@gauss.mmlai.UUCP> Date: 11 Aug 90 00:34:16 GMT Organization: Martin Marietta Labs, Baltimore Lines: 42 The folowing program for millisecond sleep works under HP-UX SYSV, so it should work on an ATT (serious finger crossing :-). Compile with: cc -O timer.c -o timer --------------------------------- cut here ----------------------------------- #include #include void myhandler() {} usleep(usec) int usec; { int sigret; struct itimerval rttimer; struct itimerval old_rttimer; struct sigaction *act, *oact ; rttimer.it_value.tv_sec = ( (float) usec) / 1000000; rttimer.it_value.tv_usec = ((float) usec) - ((float) rttimer.it_value.tv_sec * 1000000.0); rttimer.it_interval.tv_sec = 0; rttimer.it_interval.tv_usec = 0; (void) signal(SIGALRM,(myhandler)); setitimer (ITIMER_REAL, &rttimer, &old_rttimer); pause(); } main () { usleep(500000); } --------------------------- cut here -------------------------------------- ********************************************************************* Tony Burzio * OH! You have to turn it ON first! Martin Marietta Labs * mmlab!burzio@uunet.uu.net * - First day, DOS user. *********************************************************************