+ cp();
+
+ avl_delete_tree(event_tree);
+}
+
+void expire_events(void)
+{
+ avl_node_t *node;
+ event_t *event;
+ time_t diff;
+
+ /*
+ * Make all events appear expired by substracting the difference between
+ * the expiration time of the last event and the current time.
+ */
+
+ cp();
+
+ if(!event_tree->tail)
+ return;
+
+ event = event_tree->tail->data;
+ if(event->time < now)
+ return;
+
+ diff = 1 + event->time - now;
+
+ for(node = event_tree->head; node; node = node->next) {
+ event = node->data;
+ event->time -= diff;
+ }