[glib/gdate-no-dst] gdate.c: Use standard name if no daylight saving exists




commit 9e235d7b67ac638ce19f38bc71c438288081ab65
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Apr 11 12:17:25 2022 +0800

    gdate.c: Use standard name if no daylight saving exists
    
    We should normally have a standard name for the time zone even if we don't
    have daylight saving in the time zone, so use the standard name also when
    GetTimeZoneInformation() returns TIME_ZONE_ID_UNKNOWN[1][2].
    
    [1]: https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-gettimezoneinformation
    [2]: https://docs.microsoft.com/zh-tw/windows/win32/api/timezoneapi/nf-timezoneapi-settimezoneinformation

 glib/gdate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/glib/gdate.c b/glib/gdate.c
index 73a732df30..68c8689ef4 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -2556,9 +2556,7 @@ win32_strftime_helper (const GDate     *d,
              break;
            case 'Z':
              n = GetTimeZoneInformation (&tzinfo);
-             if (n == TIME_ZONE_ID_UNKNOWN)
-               ;
-             else if (n == TIME_ZONE_ID_STANDARD)
+             if (n == TIME_ZONE_ID_UNKNOWN || n == TIME_ZONE_ID_STANDARD)
                g_array_append_vals (result, tzinfo.StandardName, wcslen (tzinfo.StandardName));
              else if (n == TIME_ZONE_ID_DAYLIGHT)
                g_array_append_vals (result, tzinfo.DaylightName, wcslen (tzinfo.DaylightName));


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