Commit | Line | Data |
---|---|---|
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 | ||
7 | #ifndef lint | |
8 | static char sccsid[] = "@(#)ftime.c 5.1 (Berkeley) %G%"; | |
9 | #endif 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 */ | |
19 | struct timeb { | |
20 | time_t time; | |
21 | u_short millitm; | |
22 | short timezone; | |
23 | short dstflag; | |
24 | }; | |
25 | ||
26 | ftime(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 | } |