[BACK]Return to tzone.c CVS log [TXT][DIR] Up to [local] / src / usr.sbin / bootpd

File: [local] / src / usr.sbin / bootpd / Attic / tzone.c (download)

Revision 1.1.1.1 (vendor branch), Wed Oct 18 08:47:28 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.1: +0 -0 lines

initial import of NetBSD tree

/*
 * tzone.c - get the timezone
 *
 * This is shared by bootpd and bootpef
 */

#include <sys/types.h>

#ifdef	SVR4
/* XXX - Is this really SunOS specific? -gwr */
/* This is in <time.h> but only visible if (__STDC__ == 1). */
extern long timezone;
#else /* SVR4 */
/* BSD or SunOS */
# include <sys/time.h>
# include <syslog.h>
#endif /* SVR4 */

#include "bptypes.h"
#include "report.h"
#include "tzone.h"

/* This is what other modules use. */
int32 secondswest;

/*
 * Get our timezone offset so we can give it to clients if the
 * configuration file doesn't specify one.
 */
void
tzone_init()
{
#ifdef	SVR4
	/* XXX - Is this really SunOS specific? -gwr */
	secondswest = timezone;
#else /* SVR4 */
	struct timezone tzp;		/* Time zone offset for clients */
	struct timeval tp;			/* Time (extra baggage) */
	if (gettimeofday(&tp, &tzp) < 0) {
		secondswest = 0;		/* Assume GMT for lack of anything better */
		report(LOG_ERR, "gettimeofday: %s", get_errmsg());
	} else {
		secondswest = 60L * tzp.tz_minuteswest;	/* Convert to seconds */
	}
#endif /* SVR4 */
}