33 lines
572 B
C
33 lines
572 B
C
#if !defined(lint) && defined(SCCSIDS)
|
|
static char sccsid[] = "@(#)ftime.c 1.1 92/07/30 SMI"; /* from UCB 4.1 83/05/01 */
|
|
#endif
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/time.h>
|
|
|
|
/*
|
|
* Backwards compatible ftime.
|
|
*/
|
|
|
|
/* from old timeb.h */
|
|
struct timeb {
|
|
time_t time;
|
|
u_short millitm;
|
|
short timezone;
|
|
short dstflag;
|
|
};
|
|
|
|
ftime(tp)
|
|
register struct timeb *tp;
|
|
{
|
|
struct timeval t;
|
|
struct timezone tz;
|
|
|
|
if (gettimeofday(&t, &tz) < 0)
|
|
return (-1);
|
|
tp->time = t.tv_sec;
|
|
tp->millitm = t.tv_usec / 1000;
|
|
tp->timezone = tz.tz_minuteswest;
|
|
tp->dstflag = tz.tz_dsttime;
|
|
}
|