[glib/wip/antoniof/fallback-timezone-cache-lookup] WIP



commit 84849b27b400c54f76281810b4cc4a7a5f411727
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Oct 15 12:55:28 2020 +0100

    WIP
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/gtimezone.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/glib/gtimezone.c b/glib/gtimezone.c
index 085e87eed..73c85923e 100644
--- a/glib/gtimezone.c
+++ b/glib/gtimezone.c
@@ -1704,8 +1704,11 @@ g_time_zone_new (const gchar *identifier)
 #endif
       if (tz_default)
         {
-          /* Flush default if changed */
-          if (g_strcmp0 (tz_default->name, resolved_identifier))
+          /* Flush default if changed. If the identifier couldn’t be resolved,
+           * we’re going to fall back to UTC eventually, so don’t clear out the
+           * cache if it’s already UTC. */
+          if (!(resolved_identifier == NULL && g_str_equal (tz_default->name, "UTC")) &&
+              g_strcmp0 (tz_default->name, resolved_identifier) != 0)
             {
               g_message ("%s: Flushing tz_default %s %s", G_STRFUNC, tz_default->name, resolved_identifier);
               g_clear_pointer (&tz_default, g_time_zone_unref);


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