mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
add timezone to g_date_time_new_from_iso8601 call
This commit is contained in:
parent
8d7449d26f
commit
1453f46fcf
@ -57,6 +57,7 @@ static int skip_next_printtext;
|
|||||||
static char *log_theme_name;
|
static char *log_theme_name;
|
||||||
|
|
||||||
static char **autolog_ignore_targets;
|
static char **autolog_ignore_targets;
|
||||||
|
static GTimeZone *utc;
|
||||||
|
|
||||||
static char *log_colorizer_strip(const char *str)
|
static char *log_colorizer_strip(const char *str)
|
||||||
{
|
{
|
||||||
@ -542,7 +543,7 @@ static void log_line(TEXT_DEST_REC *dest, const char *text)
|
|||||||
char *val;
|
char *val;
|
||||||
if ((val = g_hash_table_lookup(dest->meta, "time")) != NULL) {
|
if ((val = g_hash_table_lookup(dest->meta, "time")) != NULL) {
|
||||||
GDateTime *time;
|
GDateTime *time;
|
||||||
if ((time = g_date_time_new_from_iso8601(val, NULL)) != NULL) {
|
if ((time = g_date_time_new_from_iso8601(val, utc)) != NULL) {
|
||||||
t = g_date_time_to_unix(time);
|
t = g_date_time_to_unix(time);
|
||||||
g_date_time_unref(time);
|
g_date_time_unref(time);
|
||||||
}
|
}
|
||||||
@ -744,6 +745,7 @@ void fe_log_init(void)
|
|||||||
{
|
{
|
||||||
autoremove_tag = g_timeout_add(60000, (GSourceFunc) sig_autoremove, NULL);
|
autoremove_tag = g_timeout_add(60000, (GSourceFunc) sig_autoremove, NULL);
|
||||||
skip_next_printtext = FALSE;
|
skip_next_printtext = FALSE;
|
||||||
|
utc = g_time_zone_new_utc();
|
||||||
|
|
||||||
settings_add_bool("log", "awaylog_colors", TRUE);
|
settings_add_bool("log", "awaylog_colors", TRUE);
|
||||||
settings_add_bool("log", "autolog", FALSE);
|
settings_add_bool("log", "autolog", FALSE);
|
||||||
@ -811,6 +813,7 @@ void fe_log_deinit(void)
|
|||||||
if (autolog_ignore_targets != NULL)
|
if (autolog_ignore_targets != NULL)
|
||||||
g_strfreev(autolog_ignore_targets);
|
g_strfreev(autolog_ignore_targets);
|
||||||
|
|
||||||
|
g_time_zone_unref(utc);
|
||||||
g_free_not_null(autolog_path);
|
g_free_not_null(autolog_path);
|
||||||
g_free_not_null(log_theme_name);
|
g_free_not_null(log_theme_name);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ TEXT_BUFFER_REC *color_buf;
|
|||||||
gboolean scrollback_format;
|
gboolean scrollback_format;
|
||||||
gboolean show_server_time;
|
gboolean show_server_time;
|
||||||
int signal_gui_render_line_text;
|
int signal_gui_render_line_text;
|
||||||
|
GTimeZone *utc;
|
||||||
|
|
||||||
static void collector_free(GSList **collector)
|
static void collector_free(GSList **collector)
|
||||||
{
|
{
|
||||||
@ -125,7 +126,7 @@ static LINE_INFO_META_REC *line_meta_create(GHashTable *meta_hash)
|
|||||||
while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) {
|
while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) {
|
||||||
if (g_strcmp0("time", key) == 0) {
|
if (g_strcmp0("time", key) == 0) {
|
||||||
GDateTime *time;
|
GDateTime *time;
|
||||||
if ((time = g_date_time_new_from_iso8601(val, NULL)) != NULL) {
|
if ((time = g_date_time_new_from_iso8601(val, utc)) != NULL) {
|
||||||
meta->server_time = g_date_time_to_unix(time);
|
meta->server_time = g_date_time_to_unix(time);
|
||||||
g_date_time_unref(time);
|
g_date_time_unref(time);
|
||||||
}
|
}
|
||||||
@ -446,6 +447,7 @@ static void read_settings(void)
|
|||||||
void textbuffer_formats_init(void)
|
void textbuffer_formats_init(void)
|
||||||
{
|
{
|
||||||
signal_gui_render_line_text = signal_get_uniq_id("gui render line text");
|
signal_gui_render_line_text = signal_get_uniq_id("gui render line text");
|
||||||
|
utc = g_time_zone_new_utc();
|
||||||
|
|
||||||
settings_add_bool("lookandfeel", "scrollback_format", TRUE);
|
settings_add_bool("lookandfeel", "scrollback_format", TRUE);
|
||||||
settings_add_bool("lookandfeel", "show_server_time", FALSE);
|
settings_add_bool("lookandfeel", "show_server_time", FALSE);
|
||||||
@ -463,4 +465,6 @@ void textbuffer_formats_deinit(void)
|
|||||||
signal_remove("print format", (SIGNAL_FUNC) sig_print_format);
|
signal_remove("print format", (SIGNAL_FUNC) sig_print_format);
|
||||||
signal_remove("print noformat", (SIGNAL_FUNC) sig_print_noformat);
|
signal_remove("print noformat", (SIGNAL_FUNC) sig_print_noformat);
|
||||||
signal_remove("gui print text finished", (SIGNAL_FUNC) sig_gui_print_text_finished);
|
signal_remove("gui print text finished", (SIGNAL_FUNC) sig_gui_print_text_finished);
|
||||||
|
|
||||||
|
g_time_zone_unref(utc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user