ATT Unix millisec clock

Thomas Tornblom thomas at uplog.se
Thu Aug 9 20:48:32 AEST 1990


In article <3213 at uniol.UUCP> moeller at uniol.UUCP (Klaus Moeller) writes:


   freiss at nixpbe.UUCP (the hacker) writes:


   >So far, only SECOND resolution is permitted through the ATT Unix OS to time
   >the elapsed time of a job.  Millisecond resolution (or better) accessed
   >from a .c executable is desired.  I am running ATT Unix Version System 5
   >Version 3.2 on a Motorola 68020 based machine.

   >System interrupts? Shell commands? Any solution to this thorny problem would
   >be greatly appreciated...

   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).

   IF you have the select call on your machine, you can build yourself a
   fine tuneable sleep call. Simply build an empty file set and select on it
   with the numbber of milliseconds you want to sleep.
   Since the call has nothing to select, it will time out and your program
   will resume after that number of millseconds.

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

	   Klaus Moeller
   -- 
    / Klaus Moeller, Leiteweg 2, 2940 Wilhelmshaven, West - Germany           \
   <  moeller at uniol.uucp                  078326 at DOLUNI1.BITNET                >
    \    Fill what's empty, empty what's full and scratch where it itches     /

Check out times(2).
The return value is the number of ticks (interrupts) "from an arbitrary
point in the past".
The tick frequency can be obtained from <sys/param.h> as HZ.
Normally it will be between 50 and 100 so you wont get ms accuracy.
50 to 100 times better than seconds anyhow. 

Nowhere in my manual can I find anything saying that the RESOLUTION is
in seconds, only that the times are reported in seconds. On our machines
we have at least one decimal yielding 100ms resolution.

Thomas
-- 
Real life:	Thomas Tornblom		Email:	thomas at uplog.se
Snail mail:	TeleLOGIC Uppsala AB		Phone:	+46 18 189406
		Box 1218			Fax:	+46 18 132039
		S - 751 42 Uppsala, Sweden



More information about the Comp.unix.questions mailing list