diff options
author | dirk <dirk@FreeBSD.org> | 2000-11-10 12:19:53 +0000 |
---|---|---|
committer | dirk <dirk@FreeBSD.org> | 2000-11-10 12:19:53 +0000 |
commit | c9dfa8c82c64c0034287294d21a89d5ed84771a6 (patch) | |
tree | 70958752c33b1f8a76bba0d8232943cc607077e7 /libexec | |
parent | 7c03e4e7576713bc17027ecd4caef02fbbe81748 (diff) | |
download | FreeBSD-src-c9dfa8c82c64c0034287294d21a89d5ed84771a6.zip FreeBSD-src-c9dfa8c82c64c0034287294d21a89d5ed84771a6.tar.gz |
Fix to=auto in bootptab.
PR: misc/5574
Submitted by: Bart Robinson <lomew@marker.cs.utah.edu>
Reviewed by: wollman
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/bootpd/tzone.c | 16 |
1 files changed, 10 insertions, 6 deletions
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 <sys/time.h> +# include <time.h> # include <syslog.h> #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 */ } |