diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-10-01 22:22:06 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-10-01 22:22:06 +0200 |
commit | d6d8b9094fb665f485af18ac1b8ce63944a23197 (patch) | |
tree | 01e9ea76856895327375a237845e0855dad86ceb /src/plugins/relay | |
parent | 56daba869ea917aa428a5911d5e49733bbda907c (diff) | |
download | weechat-d6d8b9094fb665f485af18ac1b8ce63944a23197.zip |
irc: replace call to gmtime by gmtime_r
Diffstat (limited to 'src/plugins/relay')
-rw-r--r-- | src/plugins/relay/irc/relay-irc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index 6c7f5aff3..61b9a7239 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -603,7 +603,7 @@ relay_irc_get_line_info (struct t_relay_client *client, const char *ptr_tag, *ptr_message, *ptr_nick, *ptr_nick1, *ptr_nick2; const char *ptr_host, *localvar_nick, *time_format; time_t msg_date; - struct tm *tm; + struct tm *tm, gm_time; if (irc_command) *irc_command = -1; @@ -741,9 +741,12 @@ relay_irc_get_line_info (struct t_relay_client *client, if (tags && (RELAY_IRC_DATA(client, server_capabilities) & (1 << RELAY_IRC_CAPAB_SERVER_TIME))) { - tm = gmtime (&msg_date); - if (strftime (str_time, sizeof (str_time), "%Y-%m-%dT%H:%M:%S", tm) == 0) + gmtime_r (&msg_date, &gm_time); + if (strftime (str_time, sizeof (str_time), "%Y-%m-%dT%H:%M:%S", + &gm_time) == 0) + { str_time[0] = '\0'; + } snprintf (str_tag, sizeof (str_tag), "@time=%s.000Z ", str_time); *tags = strdup (str_tag); } |