50 #include <sys/cdefs.h>
53 #include <sys/param.h>
54 #include <sys/systm.h>
55 #include <sys/kernel.h>
57 #include <sys/clock.h>
58 #include <sys/sysctl.h>
59 #include <sys/timetc.h>
70 0,
"Disallow adjusting time-of-day clock");
80 "time-of-day clock: clock %s has higher "
86 "time-of-day clock: clock %s has higher "
92 clock_adj.tv_nsec = res / 2 % 1000000 * 1000;
95 "(resolution %ldus, adjustment %jd.%09jds)\n", res,
116 printf(
"warning: no time-of-day clock registered, system time "
117 "will not be set accurately\n");
122 if (error != 0 && error != EINVAL) {
123 printf(
"warning: clock_gettime failed (%d), the system time "
124 "will not be set accurately\n", error);
127 if (error == EINVAL || ts.tv_sec < 0) {
128 printf(
"Invalid time in real time clock.\n"
129 "Check and reset the date immediately!\n");
162 if ((error = CLOCK_SETTIME(
clock_dev, &ts)) != 0)
163 printf(
"warning: clock_settime failed (%d), time-of-day clock "
164 "not adjusted to system time\n", error);
void inittodr(time_t base)
int device_printf(device_t dev, const char *fmt,...)
Print the name of the device followed by a colon, a space and the result of calling vprintf() with th...
SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW,&disable_rtc_set, 0,"Disallow adjusting time-of-day clock")
static int disable_rtc_set
static struct timespec clock_adj
void tc_setclock(struct timespec *ts)
static device_t clock_dev
void getnanotime(struct timespec *tsp)
int printf(const char *fmt,...)
void clock_register(device_t dev, long res)
const char * device_get_name(device_t dev)
Return the name of the device's devclass or NULL if there is none.