aboutsummaryrefslogtreecommitdiff
path: root/libexec/bootpd/tzone.c
diff options
context:
space:
mode:
authorDirk Froemberg <dirk@FreeBSD.org>2000-11-10 12:19:53 +0000
committerDirk Froemberg <dirk@FreeBSD.org>2000-11-10 12:19:53 +0000
commit59cc881262472108462b0e6b52a51a787e47ae67 (patch)
treecab7c56bba52469ac2a8555292deb3e3ec02f6d1 /libexec/bootpd/tzone.c
parent25214d26b5a62af9f2d9795c99b0a5e791c10aae (diff)
Notes
Diffstat (limited to 'libexec/bootpd/tzone.c')
-rw-r--r--libexec/bootpd/tzone.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libexec/bootpd/tzone.c b/libexec/bootpd/tzone.c
index 4adc4ae25c63..354fb54ed373 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 */
}