diff options
author | phk <phk@FreeBSD.org> | 2006-10-02 18:23:37 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-10-02 18:23:37 +0000 |
commit | 638e020bc6857faa5fda80000dcd6c68e81077b3 (patch) | |
tree | 3489b6aebb6a369a6ddad98553ec18fdc627975e | |
parent | 5d888a06551915d7b826dd6177fc33ea8deb877d (diff) | |
download | FreeBSD-src-638e020bc6857faa5fda80000dcd6c68e81077b3.zip FreeBSD-src-638e020bc6857faa5fda80000dcd6c68e81077b3.tar.gz |
Use utc_offset() where applicable, and hide the internals of it
as static variables.
-rw-r--r-- | sys/amd64/isa/clock.c | 4 | ||||
-rw-r--r-- | sys/dev/twa/tw_osl_inline.h | 4 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_conv.c | 8 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_subr.c | 8 | ||||
-rw-r--r-- | sys/kern/subr_clock.c | 6 | ||||
-rw-r--r-- | sys/kern/subr_rtc.c | 8 | ||||
-rw-r--r-- | sys/sys/clock.h | 3 |
7 files changed, 15 insertions, 26 deletions
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index c4572ed..49b7bbf 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -662,7 +662,7 @@ inittodr(time_t base) /* sec now contains the number of seconds, since Jan 1 1970, in the local time zone */ - sec += tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0); + sec += utc_offset(); y = time_second - sec; if (y <= -2 || y >= 2) { @@ -700,7 +700,7 @@ resettodr() /* Calculate local time to put in RTC */ - tm -= tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0); + tm -= utc_offset(); writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */ writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */ diff --git a/sys/dev/twa/tw_osl_inline.h b/sys/dev/twa/tw_osl_inline.h index a4b4214..f9b1c6a 100644 --- a/sys/dev/twa/tw_osl_inline.h +++ b/sys/dev/twa/tw_osl_inline.h @@ -276,9 +276,7 @@ tw_osl_write_reg_inline(struct tw_cl_ctlr_handle *ctlr_handle, * Return value: local time */ #define tw_osl_get_local_time() \ - (time_second - (tz_minuteswest * 60) - \ - (wall_cmos_clock ? adjkerntz : 0)) - + (time_second - utc_offset()) /* diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c index 21836f2..c9dee48 100644 --- a/sys/fs/msdosfs/msdosfs_conv.c +++ b/sys/fs/msdosfs/msdosfs_conv.c @@ -55,7 +55,7 @@ #include <sys/clock.h> #include <sys/kernel.h> /* defines tz */ #include <sys/systm.h> -#include <machine/clock.h> +#include <sys/clock.h> #include <sys/dirent.h> #include <sys/iconv.h> #include <sys/mount.h> @@ -127,8 +127,7 @@ unix2dostime(tsp, ddp, dtp, dhp) * If the time from the last conversion is the same as now, then * skip the computations and use the saved result. */ - t = tsp->tv_sec - (tz_minuteswest * 60) - - (wall_cmos_clock ? adjkerntz : 0); + t = tsp->tv_sec - utc_offset(); /* - daylight savings time correction */ t &= ~1; if (lasttime != t) { @@ -239,8 +238,7 @@ dos2unixtime(dd, dt, dh, tsp) days += ((dd & DD_DAY_MASK) >> DD_DAY_SHIFT) - 1; lastseconds = (days * 24 * 60 * 60) + SECONDSTO1980; } - tsp->tv_sec = seconds + lastseconds + (tz_minuteswest * 60) - + adjkerntz; + tsp->tv_sec = seconds + lastseconds + utc_offset(); /* + daylight savings time correction */ tsp->tv_nsec = (dh % 100) * 10000000; } diff --git a/sys/fs/nwfs/nwfs_subr.c b/sys/fs/nwfs/nwfs_subr.c index eabcc5f..e5da24a 100644 --- a/sys/fs/nwfs/nwfs_subr.c +++ b/sys/fs/nwfs/nwfs_subr.c @@ -37,7 +37,7 @@ #include <sys/clock.h> #include <sys/lockmgr.h> #include <sys/malloc.h> -#include <machine/clock.h> +#include <sys/clock.h> #include <sys/time.h> #include <netncp/ncp.h> @@ -598,8 +598,7 @@ ncp_unix2dostime(tsp, tzoff, ddp, dtp, dhp) * If the time from the last conversion is the same as now, then * skip the computations and use the saved result. */ - t = tsp->tv_sec - tzoff * 60 - tz_minuteswest * 60 - - (wall_cmos_clock ? adjkerntz : 0); + t = tsp->tv_sec - tzoff * 60 - utc_offset(); t &= ~1; if (lasttime != t) { lasttime = t; @@ -708,7 +707,6 @@ ncp_dos2unixtime(dd, dt, dh, tzoff, tsp) days += ((dd & DD_DAY_MASK) >> DD_DAY_SHIFT) - 1; lastseconds = (days * 24 * 60 * 60) + SECONDSTO1980; } - tsp->tv_sec = seconds + lastseconds + tz_minuteswest * 60 + - tzoff * 60 + (wall_cmos_clock ? adjkerntz : 0); + tsp->tv_sec = seconds + lastseconds + tzoff * 60 + utc_offset(); tsp->tv_nsec = (dh % 100) * 10000000; } diff --git a/sys/kern/subr_clock.c b/sys/kern/subr_clock.c index 7586402..fe6adf9 100644 --- a/sys/kern/subr_clock.c +++ b/sys/kern/subr_clock.c @@ -49,9 +49,9 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <sys/timetc.h> -int adjkerntz; /* local offset from GMT in seconds */ -int disable_rtc_set; /* disable resettodr() if != 0 */ -int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ +static int adjkerntz; /* local offset from GMT in seconds */ +static int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ +int disable_rtc_set; /* disable resettodr() if != 0 */ int tz_minuteswest; int tz_dsttime; diff --git a/sys/kern/subr_rtc.c b/sys/kern/subr_rtc.c index ba1d719..df0df32 100644 --- a/sys/kern/subr_rtc.c +++ b/sys/kern/subr_rtc.c @@ -58,9 +58,6 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <sys/timetc.h> -/* XXX: for the CPU_* sysctl OID constants. */ -#include <machine/cpu.h> - #include "clock_if.h" static device_t clock_dev = NULL; @@ -132,8 +129,7 @@ inittodr(time_t base) printf("Check and reset the date immediately!\n"); } - ts.tv_sec += tz_minuteswest * 60 + - (wall_cmos_clock ? adjkerntz : 0); + ts.tv_sec += utc_offset(); if (timespeccmp(&ref, &ts, >)) { diff = ref; @@ -161,7 +157,7 @@ resettodr() return; getnanotime(&ts); - ts.tv_sec -= tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0); + ts.tv_sec -= utc_offset(); if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0) { printf("warning: clock_settime failed (%d), time-of-day clock " "not adjusted to system time\n", error); diff --git a/sys/sys/clock.h b/sys/sys/clock.h index 50c19a8..072328d 100644 --- a/sys/sys/clock.h +++ b/sys/sys/clock.h @@ -49,8 +49,7 @@ void inittodr(time_t base); void resettodr(void); void startrtclock(void); -extern int wall_cmos_clock; -extern int adjkerntz; + extern int disable_rtc_set; /* |