mcvert needs timeb.h?

David Marks marks at AIVAX.RADC.AF.MIL
Sat Mar 9 01:05:44 AEST 1991


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 at aivax.radc.af.mil



More information about the Comp.sys.sgi mailing list