void upgrade_weechat_end () { struct timeval tv_now; long long time_diff; /* remove .upgrade files */ util_exec_on_files (weechat_home, 0, NULL, &upgrade_weechat_remove_file_cb); /* display message for end of /upgrade with duration */ gettimeofday (&tv_now, NULL); time_diff = util_timeval_diff (&weechat_current_start_timeval, &tv_now); gui_chat_printf (NULL, /* TRANSLATORS: %.02fs is a float number + "s" ("seconds") */ _("Upgrade done (%.02fs)"), ((float)time_diff) / 1000000); /* upgrading ended */ weechat_upgrading = 0; /* send signal for end of /upgrade */ (void) hook_signal_send ("upgrade_ended", WEECHAT_HOOK_SIGNAL_STRING, NULL); }
void debug_time_end (int display) { struct timeval debug_timeval_end; long long diff, diff_hour, diff_min, diff_sec, diff_usec; gettimeofday (&debug_timeval_end, NULL); diff = util_timeval_diff (&debug_timeval_start, &debug_timeval_end); diff_usec = diff % 1000000; diff_sec = (diff / 1000000) % 60; diff_min = ((diff / 1000000) / 60) % 60; diff_hour = (diff / 1000000) / 3600; if (display) { gui_chat_printf (NULL, "debug: time[%s] -> %lld:%02lld:%02lld.%06d", (debug_time_name) ? debug_time_name : "?", diff_hour, diff_min, diff_sec, diff_usec); } else { log_printf ("debug: time[%s] -> %lld:%02lld:%02lld.%06d", (debug_time_name) ? debug_time_name : "?", diff_hour, diff_min, diff_sec, diff_usec); } }
void debug_display_time_elapsed (struct timeval *time1, struct timeval *time2, const char *message, int display) { struct timeval debug_timeval_end; long long diff, diff_hour, diff_min, diff_sec, diff_usec; gettimeofday (&debug_timeval_end, NULL); diff = util_timeval_diff (time1, time2); diff_usec = diff % 1000000; diff_sec = (diff / 1000000) % 60; diff_min = ((diff / 1000000) / 60) % 60; diff_hour = (diff / 1000000) / 3600; if (display) { gui_chat_printf (NULL, "debug: time[%s] -> %lld:%02lld:%02lld.%06d", (message) ? message : "?", diff_hour, diff_min, diff_sec, diff_usec); } else { log_printf ("debug: time[%s] -> %lld:%02lld:%02lld.%06d", (message) ? message : "?", diff_hour, diff_min, diff_sec, diff_usec); } }
struct t_gui_hotlist * gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_hotlist) { struct t_gui_hotlist *ptr_hotlist; switch (CONFIG_INTEGER(config_look_hotlist_sort)) { case CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC: for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { if ((new_hotlist->priority > ptr_hotlist->priority) || ((new_hotlist->priority == ptr_hotlist->priority) && (util_timeval_diff (&(new_hotlist->creation_time), &(ptr_hotlist->creation_time)) > 0))) return ptr_hotlist; } break; case CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_DESC: for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { if ((new_hotlist->priority > ptr_hotlist->priority) || ((new_hotlist->priority == ptr_hotlist->priority) && (util_timeval_diff (&(new_hotlist->creation_time), &(ptr_hotlist->creation_time)) < 0))) return ptr_hotlist; } break; case CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_ASC: for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { if ((new_hotlist->priority > ptr_hotlist->priority) || ((new_hotlist->priority == ptr_hotlist->priority) && (new_hotlist->buffer->number < ptr_hotlist->buffer->number))) return ptr_hotlist; } break; case CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_DESC: for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { if ((new_hotlist->priority > ptr_hotlist->priority) || ((new_hotlist->priority == ptr_hotlist->priority) && (new_hotlist->buffer->number > ptr_hotlist->buffer->number))) return ptr_hotlist; } break; case CONFIG_LOOK_HOTLIST_SORT_NUMBER_ASC: for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { if (new_hotlist->buffer->number < ptr_hotlist->buffer->number) return ptr_hotlist; } break; case CONFIG_LOOK_HOTLIST_SORT_NUMBER_DESC: for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { if (new_hotlist->buffer->number > ptr_hotlist->buffer->number) return ptr_hotlist; } break; } return NULL; }