[libgweather/ebassi/gtk4: 8/56] Replace use of deprecated GTimeZone constructor




commit 5d4740816d3da4249c1517c4fda7df063b3e7f32
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Oct 5 18:00:54 2021 +0100

    Replace use of deprecated GTimeZone constructor
    
    Use g_time_zone_new_identifier() instead of g_time_zone_new().

 libgweather/weather-metno.c | 5 ++++-
 libgweather/weather-owm.c   | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libgweather/weather-metno.c b/libgweather/weather-metno.c
index 5b35e238..2145ac78 100644
--- a/libgweather/weather-metno.c
+++ b/libgweather/weather-metno.c
@@ -131,7 +131,10 @@ date_to_time_t (const xmlChar *str, const char * tzid)
     if (*after == 'Z')
        tzid = "UTC";
 
-    tz = g_time_zone_new (tzid);
+    tz = g_time_zone_new_identifier (tzid);
+    if (tz == NULL)
+        tz = g_time_zone_new_utc ();
+
     dt = g_date_time_new (tz,
                          time.tm_year + 1900,
                          time.tm_mon + 1,
diff --git a/libgweather/weather-owm.c b/libgweather/weather-owm.c
index e756fe3a..9bcd6a1c 100644
--- a/libgweather/weather-owm.c
+++ b/libgweather/weather-owm.c
@@ -142,7 +142,10 @@ date_to_time_t (const xmlChar *str, const char * tzid)
     if (*after == 'Z')
        tzid = "UTC";
 
-    tz = g_time_zone_new (tzid);
+    tz = g_time_zone_new_identifier (tzid);
+    if (tz == NULL)
+        tz = g_time_zone_new_utc ();
+
     dt = g_date_time_new (tz,
                          time.tm_year + 1900,
                          time.tm_mon + 1,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]