ATT Unix millisec clock

Guy Harris guy at auspex.auspex.com
Fri Aug 10 07:35:53 AEST 1990


>We faced the same problem, finer than one-second resolution, here before.
>We use SysV3.1 on a 68020 type too (with some BSD enhancements).

Such as the "select()" call you used....

>IF you have the select call on your machine, you can build yourself a
>fine tuneable sleep call.

Or try the same trick with "poll()", if you don't have "select()".

>If you want to have a millisecond - precise clock or somthing like that,
>I'm sorry, I can offer no help.

If you want the wall-clock time to higher resolution, you need an
extension such as "gettimeofday()" (some systems, including S5R4, have
this).

If you want alarms delivered with finer-than-one-second granularity, you
need an extension such as "setitimer()" (some systems, including S5R4,
have this). 

If you want to compute the *interval* between two events with
finer-than-one-second resolution, check out the "times()" call - it runs
the number of clock ticks (as defined by HZ in <sys/param.h>) since some
unspecified event in the past (typically, but not necessarily, the time
at which the machine was booted).  You can subtract two of those return
values to get the interval with finer-than-one-second resolution.



More information about the Comp.unix.questions mailing list