[glib/win32-enhance-gtimezone-2-60: 3/4] gdatetime.c: Fix identifier assignment on Windows



commit 46f6253c43ffa7e7bf7f9827c6013f9fa1d298b6
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Jun 13 16:28:47 2019 +0800

    gdatetime.c: Fix identifier assignment on Windows
    
    On Windows, we may be using the US DST boundaries by using the default
    "Pacific Standard Time" for rules_from_windows_time_zone() in
    rules_from_identifier().  This has the unfortunate side-effect of
    hardcoding the out_identifier to "Pacific Standard Time", which is
    likely not what we want.
    
    Instead, upon retrieving the items successfully using
    rules_from_windows_time_zone ("Pacific Standard Time", ...), we just
    re-set the out_identifier to whatever identifier that was passed into
    rules_from_identifier().

 glib/gtimezone.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/glib/gtimezone.c b/glib/gtimezone.c
index 279a78875..ef9b5fdea 100644
--- a/glib/gtimezone.c
+++ b/glib/gtimezone.c
@@ -1395,6 +1395,12 @@ rules_from_identifier (const gchar   *identifier,
                                                      out_identifier,
                                                      rules)))
         {
+          /* We don't want to hardcode our identifier here as
+           * "Pacific Standard Time", use what was passed in
+           */
+          g_free (*out_identifier);
+          *out_identifier = g_strdup (identifier);
+
           for (i = 0; i < rules_num - 1; i++)
             {
               (*rules)[i].std_offset = - tzr.std_offset;


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