1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 static char sccsid[] = "@(#)ftime.c 5.3 (Berkeley) 04/19/91"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <sys/types.h> 13 #include <sys/time.h> 14 15 /* 16 * Backwards compatible ftime. 17 */ 18 19 /* from old timeb.h */ 20 struct timeb { 21 time_t time; 22 u_short millitm; 23 short timezone; 24 short dstflag; 25 }; 26 27 ftime(tp) 28 register struct timeb *tp; 29 { 30 struct timeval t; 31 struct timezone tz; 32 33 if (gettimeofday(&t, &tz) < 0) 34 return (-1); 35 tp->time = t.tv_sec; 36 tp->millitm = t.tv_usec / 1000; 37 tp->timezone = tz.tz_minuteswest; 38 tp->dstflag = tz.tz_dsttime; 39 } 40