xref: /titanic_52/usr/src/lib/libresolv2/common/bsd/gettimeofday.c (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
1 /*
2  * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 #ifndef LINT
7 static const char rcsid[] = "$Id: gettimeofday.c,v 8.4 1999/10/13 16:39:21 vixie Exp $";
8 #endif
9 
10 
11 #pragma ident	"%Z%%M%	%I%	%E% SMI"
12 
13 #include "port_before.h"
14 #include "port_after.h"
15 
16 #if !defined(NEED_GETTIMEOFDAY)
17 int __bindcompat_gettimeofday;
18 #else
19 int
20 gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp) {
21 	time_t clock, time(time_t *);
22 
23 	if (time(&clock) == (time_t) -1)
24 		return (-1);
25 	if (tvp) {
26 		tvp->tv_sec = clock;
27 		tvp->tv_usec = 0;
28 	}
29 	if (tzp) {
30 		tzp->tz_minuteswest = 0;
31 		tzp->tz_dsttime = 0;
32 	}
33 	return (0);
34 }
35 #endif /*NEED_GETTIMEOFDAY*/
36