+
+void
+clock_adjtime(
+ int32_t *secs,
+ int32_t *microsecs)
+{
+ uint32_t interval;
+ spl_t s;
+
+ s = splclock();
+ simple_lock(&calend_adjlock);
+
+ interval = clock_set_calendar_adjtime(secs, microsecs);
+ if (interval != 0) {
+ if (calend_adjdeadline >= interval)
+ calend_adjdeadline -= interval;
+ clock_deadline_for_periodic_event(interval, mach_absolute_time(),
+ &calend_adjdeadline);
+
+ timer_call_enter(&calend_adjcall, calend_adjdeadline);
+ }
+ else
+ timer_call_cancel(&calend_adjcall);
+
+ simple_unlock(&calend_adjlock);
+ splx(s);
+}
+
+static void
+calend_adjust_call(
+ timer_call_param_t p0,
+ timer_call_param_t p1)
+{
+ uint32_t interval;
+ spl_t s;
+
+ s = splclock();
+ simple_lock(&calend_adjlock);
+
+ interval = clock_adjust_calendar();
+ if (interval != 0) {
+ clock_deadline_for_periodic_event(interval, mach_absolute_time(),
+ &calend_adjdeadline);
+
+ timer_call_enter(&calend_adjcall, calend_adjdeadline);
+ }
+
+ simple_unlock(&calend_adjlock);
+ splx(s);
+}
+
+void
+clock_wakeup_calendar(void)
+{
+ thread_call_enter(&calend_wakecall);
+}
+
+static void
+calend_dowakeup(
+ thread_call_param_t p0,
+ thread_call_param_t p1)
+{
+ void IOKitResetTime(void);
+
+ IOKitResetTime();
+}