+void
+evperiodic_start (struct ev_periodic *w)
+{
+ if (ev_is_active (w))
+ return;
+
+ assert (("periodic interval value less than zero not allowed", w->interval >= 0.));
+
+ /* this formula differs from the one in periodic_reify because we do not always round up */
+ if (w->interval)
+ w->at += ceil ((ev_now - w->at) / w->interval) * w->interval;
+
+ ev_start ((W)w, ++periodiccnt);
+ array_needsize (periodics, periodicmax, periodiccnt, );
+ periodics [periodiccnt - 1] = w;
+ upheap ((WT *)periodics, periodiccnt - 1);
+}
+
+void
+evperiodic_stop (struct ev_periodic *w)
+{
+ if (!ev_is_active (w))
+ return;
+
+ if (w->active < periodiccnt--)
+ {
+ periodics [w->active - 1] = periodics [periodiccnt];
+ downheap ((WT *)periodics, periodiccnt, w->active - 1);
+ }
+
+ ev_stop ((W)w);