xref: /original-bsd/lib/libcompat/4.1/ftime.c (revision f82e54c4)
1 /*	ftime.c	4.1	83/05/31	*/
2 
3 #include <sys/types.h>
4 #include <sys/time.h>
5 
6 /*
7  * Backwards compatible ftime.
8  */
9 
10 /* from old timeb.h */
11 struct timeb {
12 	time_t	time;
13 	u_short	millitm;
14 	short	timezone;
15 	short	dstflag;
16 };
17 
18 ftime(tp)
19 	register struct timeb *tp;
20 {
21 	struct timeval t;
22 	struct timezone tz;
23 
24 	if (gettimeofday(&t, &tz) < 0)
25 		return (-1);
26 	tp->time = t.tv_sec;
27 	tp->millitm = t.tv_usec / 1000;
28 	tp->timezone = tz.tz_minuteswest;
29 	tp->dstflag = tz.tz_dsttime;
30 }
31