Timing short intervals
Jon Ryshpan
jon at hitachi.uucp
Tue Jun 11 09:25:29 AEST 1991
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>
More information about the Comp.unix.sysv386
mailing list