aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmm-glib/mm-common-helpers.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c
index de49136d..b57cb205 100644
--- a/libmm-glib/mm-common-helpers.c
+++ b/libmm-glib/mm-common-helpers.c
@@ -1783,8 +1783,20 @@ mm_new_iso8601_time (guint year,
if (have_offset) {
g_autoptr(GTimeZone) tz = NULL;
-
+#if GLIB_CHECK_VERSION (2, 58, 0)
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
tz = g_time_zone_new_offset (offset_minutes * 60);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#else
+ g_autofree gchar *identifier = NULL;
+
+ identifier = g_strdup_printf ("%c%02u:%02u:00",
+ (offset_minutes >= 0) ? '+' : '-',
+ ABS (offset_minutes) / 60,
+ ABS (offset_minutes) % 60);
+
+ tz = g_time_zone_new (identifier);
+#endif
dt = g_date_time_new (tz, year, month, day, hour, minute, second);
} else
dt = g_date_time_new_utc (year, month, day, hour, minute, second);