From c9dfa8c82c64c0034287294d21a89d5ed84771a6 Mon Sep 17 00:00:00 2001 From: dirk Date: Fri, 10 Nov 2000 12:19:53 +0000 Subject: Fix to=auto in bootptab. PR: misc/5574 Submitted by: Bart Robinson Reviewed by: wollman --- libexec/bootpd/tzone.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libexec') diff --git a/libexec/bootpd/tzone.c b/libexec/bootpd/tzone.c index 4adc4ae..354fb54 100644 --- a/libexec/bootpd/tzone.c +++ b/libexec/bootpd/tzone.c @@ -2,6 +2,8 @@ * tzone.c - get the timezone * * This is shared by bootpd and bootpef + * + * $FreeBSD$ */ #ifdef SVR4 @@ -10,7 +12,7 @@ extern long timezone; #else /* SVR4 */ /* BSD or SunOS */ -# include +# include # include #endif /* SVR4 */ @@ -32,13 +34,15 @@ tzone_init() /* 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) { + struct tm *tm; + time_t now; + + (void)time(&now); + if ((tm = localtime(&now)) == NULL) { secondswest = 0; /* Assume GMT for lack of anything better */ - report(LOG_ERR, "gettimeofday: %s", get_errmsg()); + report(LOG_ERR, "localtime() failed"); } else { - secondswest = 60L * tzp.tz_minuteswest; /* Convert to seconds */ + secondswest = -tm->tm_gmtoff; } #endif /* SVR4 */ } -- cgit v1.1