diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b1fb1f3d..a4daf3485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ - ruby: fix builtin functions not available ([#2109](https://github.com/weechat/weechat/issues/2109)) - php: fix return value of function hdata_longlong - tcl: fix return value of function hdata_longlong ([#2119](https://github.com/weechat/weechat/issues/2119)) +- relay/api: fix timezone of dates sent to clients ([#2151](https://github.com/weechat/weechat/issues/2151)) - relay/api: fix "body_type" returned when lines or nicks of a buffer are requested - relay/api: fix read of one buffer line - relay: fix websocket permessage-deflate extension when the client doesn't send the max window bits parameters ([#1549](https://github.com/weechat/weechat/issues/1549)) diff --git a/src/plugins/relay/api/relay-api-msg.c b/src/plugins/relay/api/relay-api-msg.c index 9248e14cb..6c8cc8a8f 100644 --- a/src/plugins/relay/api/relay-api-msg.c +++ b/src/plugins/relay/api/relay-api-msg.c @@ -58,8 +58,10 @@ #define MSG_ADD_HDATA_TIME_USEC(__json_name, \ __var_name, __var_name_usec) \ time_value = weechat_hdata_time (hdata, pointer, __var_name); \ - gmtime_r (&time_value, &gm_time); \ - tv.tv_sec = mktime (&gm_time); \ + local_time = localtime (&time_value); \ + time_value -= local_time->tm_gmtoff; \ + local_time = localtime (&time_value); \ + tv.tv_sec = mktime (local_time); \ tv.tv_usec = weechat_hdata_integer (hdata, pointer, \ __var_name_usec); \ weechat_util_strftimeval (str_time, sizeof (str_time), \ @@ -491,7 +493,7 @@ relay_api_msg_line_data_to_json (struct t_gui_line_data *line_data, int i, tags_count; time_t time_value; struct timeval tv; - struct tm gm_time; + struct tm *local_time; hdata = relay_hdata_line_data; pointer = line_data; @@ -730,7 +732,7 @@ relay_api_msg_hotlist_to_json (struct t_gui_hotlist *hotlist) cJSON *json, *json_count; time_t time_value; struct timeval tv; - struct tm gm_time; + struct tm *local_time; char str_time[256], str_key[32]; int i, array_size; long long buffer_id;