/* * this shuld replace the g_get_current_time and the g_source_get_current_time calls in the main thread * (log_msg_init, afinter_postpone_mark) */ void cached_g_current_time(GTimeVal *result) { if (current_time_value.tv_sec == 0) { g_get_current_time(¤t_time_value); } *result = current_time_value; if (iv_inited()) { if (invalidate_time_task.handler == NULL) { IV_TASK_INIT(&invalidate_time_task); invalidate_time_task.handler = (void (*)(void *)) invalidate_cached_time; } if (!iv_task_registered(&invalidate_time_task)) iv_task_register(&invalidate_time_task); } else { invalidate_cached_time(); } }
static void _invalidate_with_sleep(guint seconds) { sleep(seconds); invalidate_cached_time(); }