FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/limits.h>
#include <sys/sysctl.h>
#include <sys/timetc.h>
Go to the source code of this file.
Macros | |
#define | FEBRUARY 2 |
#define | days_in_year(y) (leapyear(y) ? 366 : 365) |
#define | days_in_month(y, m) (month_days[(m) - 1] + (m == FEBRUARY ? leapyear(y) : 0)) |
#define | day_of_week(days) (((days) + 4) % 7) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | sysctl_machdep_adjkerntz (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_machdep, OID_AUTO, adjkerntz, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", "Local offset from UTC in seconds") | |
SYSCTL_INT (_debug, OID_AUTO, clocktime, CTLFLAG_RWTUN, &ct_debug, 0, "Enable printing of clocktime debugging") | |
SYSCTL_INT (_machdep, OID_AUTO, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, "Enables application of machdep.adjkerntz") | |
static int | leapyear (int year) |
int | clock_ct_to_ts (const struct clocktime *ct, struct timespec *ts) |
int | clock_bcd_to_ts (const struct bcd_clocktime *bct, struct timespec *ts, bool ampm) |
void | clock_ts_to_ct (const struct timespec *ts, struct clocktime *ct) |
void | clock_ts_to_bcd (const struct timespec *ts, struct bcd_clocktime *bct, bool ampm) |
void | clock_print_bcd (const struct bcd_clocktime *bct, int nsdigits) |
void | clock_print_ct (const struct clocktime *ct, int nsdigits) |
void | clock_print_ts (const struct timespec *ts, int nsdigits) |
int | utc_offset (void) |
Variables | |
static int | adjkerntz |
static int | ct_debug |
static int | wall_cmos_clock |
static const int | month_days [12] |
static const int | recent_base_year = 2017 |
static const int | recent_base_days = 17167 |
static u_int | nsdivisors [] |
Definition at line 92 of file subr_clock.c.
#define days_in_month | ( | y, | |
m | |||
) | (month_days[(m) - 1] + (m == FEBRUARY ? leapyear(y) : 0)) |
Definition at line 89 of file subr_clock.c.
#define days_in_year | ( | y | ) | (leapyear(y) ? 366 : 365) |
Definition at line 88 of file subr_clock.c.
#define FEBRUARY 2 |
Definition at line 87 of file subr_clock.c.
__FBSDID | ( | "$FreeBSD$" | ) |
int clock_bcd_to_ts | ( | const struct bcd_clocktime * | bct, |
struct timespec * | ts, | ||
bool | ampm | ||
) |
Definition at line 199 of file subr_clock.c.
References clock_ct_to_ts(), ct_debug, printf(), and ts.
int clock_ct_to_ts | ( | const struct clocktime * | ct, |
struct timespec * | ts | ||
) |
Definition at line 139 of file subr_clock.c.
References clock_print_ct(), ct_debug, days, days_in_month, days_in_year, printf(), recent_base_days, recent_base_year, and ts.
Referenced by clock_bcd_to_ts().
void clock_print_bcd | ( | const struct bcd_clocktime * | bct, |
int | nsdigits | ||
) |
Definition at line 337 of file subr_clock.c.
References nsdivisors, and printf().
Referenced by clock_dbgprint_bcd().
void clock_print_ct | ( | const struct clocktime * | ct, |
int | nsdigits | ||
) |
Definition at line 355 of file subr_clock.c.
References nsdivisors, and printf().
Referenced by clock_ct_to_ts(), clock_dbgprint_ct(), clock_print_ts(), and clock_ts_to_ct().
void clock_print_ts | ( | const struct timespec * | ts, |
int | nsdigits | ||
) |
Definition at line 373 of file subr_clock.c.
References clock_print_ct(), clock_ts_to_ct(), and ts.
Referenced by clock_dbgprint_hdr(), and clock_dbgprint_ts().
void clock_ts_to_bcd | ( | const struct timespec * | ts, |
struct bcd_clocktime * | bct, | ||
bool | ampm | ||
) |
Definition at line 309 of file subr_clock.c.
References clock_ts_to_ct(), and ts.
void clock_ts_to_ct | ( | const struct timespec * | ts, |
struct clocktime * | ct | ||
) |
Definition at line 248 of file subr_clock.c.
References clock_print_ct(), ct_debug, day_of_week, days, days_in_month, days_in_year, printf(), recent_base_days, recent_base_year, and ts.
Referenced by clock_print_ts(), and clock_ts_to_bcd().
|
static |
Definition at line 123 of file subr_clock.c.
SYSCTL_INT | ( | _debug | , |
OID_AUTO | , | ||
clocktime | , | ||
CTLFLAG_RWTUN | , | ||
& | ct_debug, | ||
0 | , | ||
"Enable printing of clocktime debugging" | |||
) |
SYSCTL_INT | ( | _machdep | , |
OID_AUTO | , | ||
wall_cmos_clock | , | ||
CTLFLAG_RW | , | ||
& | wall_cmos_clock, | ||
0 | , | ||
"Enables application of machdep.adjkerntz" | |||
) |
|
static |
Definition at line 61 of file subr_clock.c.
References resettodr(), and sysctl_handle_int().
SYSCTL_PROC | ( | _machdep | , |
OID_AUTO | , | ||
adjkerntz | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
& | adjkerntz, | ||
0 | , | ||
sysctl_machdep_adjkerntz | , | ||
"I" | , | ||
"Local offset from UTC in seconds" | |||
) |
int utc_offset | ( | void | ) |
Definition at line 382 of file subr_clock.c.
References adjkerntz, and wall_cmos_clock.
Referenced by fattime2timespec(), kern_clock_settime(), read_clocks(), settime_task_func(), and timespec2fattime().
|
static |
Definition at line 59 of file subr_clock.c.
Referenced by utc_offset().
|
static |
Definition at line 73 of file subr_clock.c.
Referenced by clock_bcd_to_ts(), clock_ct_to_ts(), and clock_ts_to_ct().
|
static |
Definition at line 94 of file subr_clock.c.
|
static |
Definition at line 110 of file subr_clock.c.
Referenced by clock_print_bcd(), and clock_print_ct().
|
static |
Definition at line 104 of file subr_clock.c.
Referenced by clock_ct_to_ts(), and clock_ts_to_ct().
|
static |
Definition at line 103 of file subr_clock.c.
Referenced by clock_ct_to_ts(), and clock_ts_to_ct().
|
static |
Definition at line 77 of file subr_clock.c.
Referenced by utc_offset().