Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!spool.mu.edu!olivea!uunet!hitachi!jon From: jon@hitachi.uucp (Jon Ryshpan) Newsgroups: comp.unix.sysv386 Subject: Timing short intervals Message-ID: <695@hitachi.uucp> Date: 10 Jun 91 23:25:29 GMT Reply-To: jon@hitachi.UUCP (Jon Ryshpan) Distribution: na Organization: Hitachi America - Semiconductor & IC Div. Lines: 40 Does anyone know how to time an interval of less than one second under ISC Unix (Version 2.2)? I tried setitimer(), which is in the library /usr/lib/libinet.a; but it doesn't seem to work as described in the BSD 4.2 documentation; and it isn't described at all in the Interactive documentation. /* This is from /usr/include/time.h */ struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 struct itimerval { struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */ }; /* This is from my program. */ struct itimerval Value; setitimer( ITIMER_REAL, &Value, 0 ); /* Program ends */ My program ignores Value.it_value.tv_usec completely. It pays attention to Value.it_value.tv_sec; but this gives a resolution of only one second. Ideas anyone? Please reply BY MAIL. I don't have time to follow this group. ^^ ^^^^ Many Thanks: Jonathan Ryshpan <...!uunet!hitachi!jon>