1*48368Sbostic /*- 2*48368Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*48368Sbostic * All rights reserved. 4*48368Sbostic * 5*48368Sbostic * %sccs.include.proprietary.c% 621326Sdist */ 712846Ssam 826516Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*48368Sbostic static char sccsid[] = "@(#)ftime.c 5.3 (Berkeley) 04/19/91"; 10*48368Sbostic #endif /* LIBC_SCCS and not lint */ 1121326Sdist 1212846Ssam #include <sys/types.h> 1312846Ssam #include <sys/time.h> 1412846Ssam 1512846Ssam /* 1612846Ssam * Backwards compatible ftime. 1712846Ssam */ 1812846Ssam 1912846Ssam /* from old timeb.h */ 2012846Ssam struct timeb { 2112846Ssam time_t time; 2212846Ssam u_short millitm; 2312846Ssam short timezone; 2412846Ssam short dstflag; 2512846Ssam }; 2612846Ssam 2712846Ssam ftime(tp) 2812846Ssam register struct timeb *tp; 2912846Ssam { 3012846Ssam struct timeval t; 3112846Ssam struct timezone tz; 3212846Ssam 3312846Ssam if (gettimeofday(&t, &tz) < 0) 3412846Ssam return (-1); 3512846Ssam tp->time = t.tv_sec; 3612846Ssam tp->millitm = t.tv_usec / 1000; 3712846Ssam tp->timezone = tz.tz_minuteswest; 3812846Ssam tp->dstflag = tz.tz_dsttime; 3912846Ssam } 40