clock.h (157084) | clock.h (162954) |
---|---|
1/*- 2 * Copyright (c) 1996 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Gordon W. Ross 7 * 8 * Redistribution and use in source and binary forms, with or without --- 21 unchanged lines hidden (view full) --- 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 * 36 * $NetBSD: clock_subr.h,v 1.7 2000/10/03 13:41:07 tsutsui Exp $ 37 * | 1/*- 2 * Copyright (c) 1996 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Gordon W. Ross 7 * 8 * Redistribution and use in source and binary forms, with or without --- 21 unchanged lines hidden (view full) --- 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 * 36 * $NetBSD: clock_subr.h,v 1.7 2000/10/03 13:41:07 tsutsui Exp $ 37 * |
38 * $FreeBSD: head/sys/sys/clock.h 157084 2006-03-24 06:27:34Z imp $ | 38 * $FreeBSD: head/sys/sys/clock.h 162954 2006-10-02 12:59:59Z phk $ |
39 */ 40 41#ifndef _SYS_CLOCK_H_ 42#define _SYS_CLOCK_H_ 43 | 39 */ 40 41#ifndef _SYS_CLOCK_H_ 42#define _SYS_CLOCK_H_ 43 |
44#ifdef _KERNEL /* No user serviceable parts */ 45 |
|
44/* | 46/* |
47 * Kernel to clock driver interface. 48 */ 49void inittodr(time_t base); 50void resettodr(void); 51void startrtclock(void); 52extern int wall_cmos_clock; 53extern int adjkerntz; 54extern int disable_rtc_set; 55 56/* 57 * Timezone info from settimeofday(2), usually not used 58 */ 59extern int tz_minuteswest; 60extern int tz_dsttime; 61 62/* |
|
45 * Structure to hold the values typically reported by time-of-day clocks. 46 * This can be passed to the generic conversion functions to be converted 47 * to a struct timespec. 48 */ 49struct clocktime { 50 int year; /* year (4 digit year) */ 51 int mon; /* month (1 - 12) */ 52 int day; /* day (1 - 31) */ --- 6 unchanged lines hidden (view full) --- 59 60int clock_ct_to_ts(struct clocktime *, struct timespec *); 61void clock_ts_to_ct(struct timespec *, struct clocktime *); 62void clock_register(device_t, long); 63 64/* 65 * BCD to decimal and decimal to BCD. 66 */ | 63 * Structure to hold the values typically reported by time-of-day clocks. 64 * This can be passed to the generic conversion functions to be converted 65 * to a struct timespec. 66 */ 67struct clocktime { 68 int year; /* year (4 digit year) */ 69 int mon; /* month (1 - 12) */ 70 int day; /* day (1 - 31) */ --- 6 unchanged lines hidden (view full) --- 77 78int clock_ct_to_ts(struct clocktime *, struct timespec *); 79void clock_ts_to_ct(struct timespec *, struct clocktime *); 80void clock_register(device_t, long); 81 82/* 83 * BCD to decimal and decimal to BCD. 84 */ |
67#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf)) 68#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10)) | 85#define FROMBCD(x) bcd2bin(x) 86#define TOBCD(x) bin2bcd(x) |
69 70/* Some handy constants. */ 71#define SECDAY (24 * 60 * 60) 72#define SECYR (SECDAY * 365) 73 74/* Traditional POSIX base year */ 75#define POSIX_BASE_YEAR 1970 76 | 87 88/* Some handy constants. */ 89#define SECDAY (24 * 60 * 60) 90#define SECYR (SECDAY * 365) 91 92/* Traditional POSIX base year */ 93#define POSIX_BASE_YEAR 1970 94 |
95#endif /* _KERNEL */ 96 |
|
77#endif /* !_SYS_CLOCK_H_ */ | 97#endif /* !_SYS_CLOCK_H_ */ |