[comp.sys.sgi] mcvert needs timeb.h?

vernon@blueeyes.kines.uiuc.edu (vernon) (03/08/91)

I am trying to compile a program called "mcvert" (shareware from sumex)
and it requires a file named "timeb.h".  However the Iris 4DGT I am using
does not possess a "timeb.h".  It does have time.h and times.h.

Should I substitute one of the available .h files?  Or do I need to acquire
the timeb.h file, and if so from where?
-- 
	Vernon McDonald  (vmcdonald@uiuc.edu)
	Department of Kinesiology, University of Illinois, Urbana, IL, 61801

marks@AIVAX.RADC.AF.MIL (David Marks) (03/08/91)

The structures in timeb.h are only referenced by the time2mac routine, so the
problem is small.  The ftime operation according to the BSD man page says:
NAME
     time, ftime - get date and time
...
DESCRIPTION
     These interfaces are obsoleted by gettimeofday(2).

     Time returns the time since 00:00:00 GMT, Jan. 1, 1970,
     measured in seconds.

So, the answer is to use <sys/time.h> and gettimeofday instead of 
<sys/timeb.h> and ftime.  The following is a first cut at what should work:

ulong time2mac(time)
ulong time;
{struct timeval tptime;
 struct timezone  tpzone;
  gettimeofday(&tptime, &tpzone);
  return long2mac(time + MACTIMEDIFF
                    - 60 * (tpzone.tz_minuteswest - 60 * tpzone.tz_dsttime));
}

Good Luck!

Dave Marks
Rome Laboratory
marks@aivax.radc.af.mil