diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2016-09-03 08:28:05 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2016-09-03 08:28:05 +0200 |
commit | 0572d0c4f50e278dae26a7b8a751ed77be981363 (patch) | |
tree | e866d2acdd196fee90425757df7084ee94723222 /src/gui | |
parent | f4b96dfa0f30167a825bb6fa5905a94bb0bf26d4 (diff) | |
download | weechat-0572d0c4f50e278dae26a7b8a751ed77be981363.zip |
core: evaluate content of option "weechat.look.item_time_format" (issue #791)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-bar-item.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index 980d9cbe1..372bac791 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -26,7 +26,6 @@ #include <stdlib.h> #include <stddef.h> #include <string.h> -#include <time.h> #include "../core/weechat.h" #include "../core/wee-arraylist.h" @@ -980,8 +979,6 @@ gui_bar_item_time_cb (const void *pointer, void *data, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { - time_t date; - struct tm *local_time; char text_time[128], text_time2[128]; /* make C compiler happy */ @@ -992,11 +989,8 @@ gui_bar_item_time_cb (const void *pointer, void *data, (void) buffer; (void) extra_info; - date = time (NULL); - local_time = localtime (&date); - if (strftime (text_time, sizeof (text_time), - CONFIG_STRING(config_look_item_time_format), - local_time) == 0) + config_get_item_time (text_time, sizeof (text_time)); + if (!text_time[0]) return NULL; snprintf (text_time2, sizeof (text_time2), "%s%s", @@ -2017,8 +2011,6 @@ gui_bar_item_focus_buffer_nicklist_cb (const void *pointer, int gui_bar_item_timer_cb (const void *pointer, void *data, int remaining_calls) { - time_t date; - struct tm *local_time; static char item_time_text[128] = { '\0' }; char new_item_time_text[128]; @@ -2026,12 +2018,7 @@ gui_bar_item_timer_cb (const void *pointer, void *data, int remaining_calls) (void) data; (void) remaining_calls; - date = time (NULL); - local_time = localtime (&date); - if (strftime (new_item_time_text, sizeof (new_item_time_text), - CONFIG_STRING(config_look_item_time_format), - local_time) == 0) - return WEECHAT_RC_OK; + config_get_item_time (new_item_time_text, sizeof (new_item_time_text)); /* * we update item only if it changed since last time |