Expand PMF_FN_* macros.
[netbsd-mini2440.git] / usr.sbin / bootp / common / tzone.c
blob426b93833a4c3473a433143d09500f92d8f50131
1 /* $NetBSD: tzone.c,v 1.4 1998/03/14 04:39:55 lukem Exp $ */
3 #include <sys/cdefs.h>
4 #ifndef lint
5 __RCSID("$NetBSD: tzone.c,v 1.4 1998/03/14 04:39:55 lukem Exp $");
6 #endif
8 /*
9 * tzone.c - get the timezone
11 * This is shared by bootpd and bootpef
14 #include <sys/types.h>
16 #ifdef SVR4
17 /* XXX - Is this really SunOS specific? -gwr */
18 /* This is in <time.h> but only visible if (__STDC__ == 1). */
19 extern long timezone;
20 #else /* SVR4 */
21 /* BSD or SunOS */
22 # include <sys/time.h>
23 # include <syslog.h>
24 #endif /* SVR4 */
26 #include "bptypes.h"
27 #include "report.h"
28 #include "tzone.h"
30 /* This is what other modules use. */
31 int32 secondswest;
34 * Get our timezone offset so we can give it to clients if the
35 * configuration file doesn't specify one.
37 void
38 tzone_init(void)
40 #ifdef SVR4
41 /* XXX - Is this really SunOS specific? -gwr */
42 secondswest = timezone;
43 #else /* SVR4 */
44 struct timezone tzp; /* Time zone offset for clients */
45 struct timeval tp; /* Time (extra baggage) */
46 if (gettimeofday(&tp, &tzp) < 0) {
47 secondswest = 0; /* Assume GMT for lack of anything better */
48 report(LOG_ERR, "gettimeofday: %s", get_errmsg());
49 } else {
50 secondswest = 60L * tzp.tz_minuteswest; /* Convert to seconds */
52 #endif /* SVR4 */