add {strcat,strcmp,strcpy}n.c; they aren't Sys V routines, they're
[unix-history] / usr / src / lib / libcompat / 4.1 / ftime.c
CommitLineData
bb0cfa24
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
2ce81398
DS
7#if defined(LIBC_SCCS) && !defined(lint)
8static char sccsid[] = "@(#)ftime.c 5.2 (Berkeley) %G%";
9#endif LIBC_SCCS and not lint
b40fad4f
SL
10
11#include <sys/types.h>
12#include <sys/time.h>
13
14/*
15 * Backwards compatible ftime.
16 */
17
18/* from old timeb.h */
19struct timeb {
20 time_t time;
21 u_short millitm;
22 short timezone;
23 short dstflag;
24};
25
26ftime(tp)
27 register struct timeb *tp;
28{
29 struct timeval t;
30 struct timezone tz;
31
32 if (gettimeofday(&t, &tz) < 0)
33 return (-1);
34 tp->time = t.tv_sec;
35 tp->millitm = t.tv_usec / 1000;
36 tp->timezone = tz.tz_minuteswest;
37 tp->dstflag = tz.tz_dsttime;
38}