How do I compile ttype?
Stephen Frede
stephenf at elecvax.eecs.unsw.oz
Fri Dec 6 19:41:11 AEST 1985
>If your system does not have timeb.h, then it also doesn't have ftime(),
>the function that uses the type "struct timeb". If you don't have this
>function, then you need a total rewrite of the program (if that is even
>possible)! ftime returns time in units SMALLER than one second. System III/V
>do not support this functionality (a major flaw, in my opinion) making
>timing tasks such as in ttype much more difficult.
V7/SysV times(2) system call returns a value in tics (1/60 or 1/100 sec in
the US, usually 1/50 sec in Australia)
The ttype program does not use the value for anything very crucial.
The following routine will probably be close enough.
#ifdef BSD
#include <sys/timeb.h>
#else
struct timeb /* only two elements used */
{
time_t time;
unsigned long millitm;
};
#define index strchr
#define rindex strrchr
#endif /* BSD */
/* ... */
#ifndef BSD
ftime(t)
struct timeb *t;
{
struct tm tbuf;
time(&t->time);
t->millitm = (times(&tbuf) % HZ) * (1000/HZ);
}
#endif /* BSD */
More information about the Comp.sources.bugs
mailing list