[comp.lang.c] TIME/TIMES mapping wanted

mks@cbnewsm.ATT.COM (manishkumar.sharma) (02/14/90)

How can I map the output given by time(2) and times(2) in system V?
Can it be done?
For e.g.  if I do this;

time1=time()
sleep 2
time2=time()	then time2-time1 is exactly 2 secs.

But if I do this;

time1=times()
sleep 2
time2=times()	then time2-time1 is about 160 (in clock ticks/sec) HZ=100.

1. Why are they different?
2. How can they be mapped as a function of each other? i.e how can I use
    time() alone to get the value given by times()?
3. Specifically, SUN's BSD version supports times(), but does not
   return anything except the status code unlike system V which actually
   returns elapsed real time. How do I use time() for this on a SUNserver?

Thanks.

-Manish Sharma
 201-949-0094
 (att,ulysses)!holin!mks