1*21326Sdist /* 2*21326Sdist * Copyright (c) 1980 Regents of the University of California. 3*21326Sdist * All rights reserved. The Berkeley software License Agreement 4*21326Sdist * specifies the terms and conditions for redistribution. 5*21326Sdist */ 612846Ssam 7*21326Sdist #ifndef lint 8*21326Sdist static char sccsid[] = "@(#)ftime.c 5.1 (Berkeley) 05/30/85"; 9*21326Sdist #endif not lint 10*21326Sdist 1112846Ssam #include <sys/types.h> 1212846Ssam #include <sys/time.h> 1312846Ssam 1412846Ssam /* 1512846Ssam * Backwards compatible ftime. 1612846Ssam */ 1712846Ssam 1812846Ssam /* from old timeb.h */ 1912846Ssam struct timeb { 2012846Ssam time_t time; 2112846Ssam u_short millitm; 2212846Ssam short timezone; 2312846Ssam short dstflag; 2412846Ssam }; 2512846Ssam 2612846Ssam ftime(tp) 2712846Ssam register struct timeb *tp; 2812846Ssam { 2912846Ssam struct timeval t; 3012846Ssam struct timezone tz; 3112846Ssam 3212846Ssam if (gettimeofday(&t, &tz) < 0) 3312846Ssam return (-1); 3412846Ssam tp->time = t.tv_sec; 3512846Ssam tp->millitm = t.tv_usec / 1000; 3612846Ssam tp->timezone = tz.tz_minuteswest; 3712846Ssam tp->dstflag = tz.tz_dsttime; 3812846Ssam } 39