aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/clock.h
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2006-10-02 12:59:59 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2006-10-02 12:59:59 +0000
commitf645b0b51cd22b129405c2c32dba1d051ae3d99c (patch)
treef5002a864a5082d410445f24b5d28a04581034f1 /sys/sys/clock.h
parent77ec673a84fac9ceb67d89bc7c2069c9ec2a7cb6 (diff)
downloadsrc-f645b0b51cd22b129405c2c32dba1d051ae3d99c.tar.gz
src-f645b0b51cd22b129405c2c32dba1d051ae3d99c.zip
First part of a little cleanup in the calendar/timezone/RTC handling.
Move relevant variables to <sys/clock.h> and fix #includes as necessary. Use libkern's much more time- & spamce-efficient BCD routines.
Notes
Notes: svn path=/head/; revision=162954
Diffstat (limited to 'sys/sys/clock.h')
-rw-r--r--sys/sys/clock.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/sys/clock.h b/sys/sys/clock.h
index 1b61b1948c0e..be0de57ba628 100644
--- a/sys/sys/clock.h
+++ b/sys/sys/clock.h
@@ -41,6 +41,24 @@
#ifndef _SYS_CLOCK_H_
#define _SYS_CLOCK_H_
+#ifdef _KERNEL /* No user serviceable parts */
+
+/*
+ * Kernel to clock driver interface.
+ */
+void inittodr(time_t base);
+void resettodr(void);
+void startrtclock(void);
+extern int wall_cmos_clock;
+extern int adjkerntz;
+extern int disable_rtc_set;
+
+/*
+ * Timezone info from settimeofday(2), usually not used
+ */
+extern int tz_minuteswest;
+extern int tz_dsttime;
+
/*
* Structure to hold the values typically reported by time-of-day clocks.
* This can be passed to the generic conversion functions to be converted
@@ -64,8 +82,8 @@ void clock_register(device_t, long);
/*
* BCD to decimal and decimal to BCD.
*/
-#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf))
-#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10))
+#define FROMBCD(x) bcd2bin(x)
+#define TOBCD(x) bin2bcd(x)
/* Some handy constants. */
#define SECDAY (24 * 60 * 60)
@@ -74,4 +92,6 @@ void clock_register(device_t, long);
/* Traditional POSIX base year */
#define POSIX_BASE_YEAR 1970
+#endif /* _KERNEL */
+
#endif /* !_SYS_CLOCK_H_ */