From 33d8cc3254bd8b2232efeb0b91eb52719c5d5e41 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Mon, 6 Apr 2020 11:55:57 +0200 Subject: [PATCH] GLib < 2.56 compat code for g_date_time_new_from_iso8601 --- src/fe-text/textbuffer-formats.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index 84aaebb9..17ec118a 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -16,6 +16,21 @@ TEXT_BUFFER_REC *color_buf; int scrollback_format; +#if GLIB_CHECK_VERSION(2, 56, 0) +/* nothing */ +#else +/* compatibility code for old GLib */ +static GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz) +{ + GTimeVal time; + if (g_time_val_from_iso8601(iso_date, &time)) { + return g_date_time_new_from_timeval_utc(&time); + } else { + return NULL; + } +} +#endif + static void collector_free(GSList **collector) { while (*collector) {