From 22612bcff5ecc7ece4acc4325aa8b19e6129b2cf Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Mon, 30 Nov 2020 22:00:34 +0900 Subject: [PATCH] ntdll: Add a timezone mapping rule for North Korea Standard Time. Otherwise, another UTC+9 timezone matches to the timezone. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50213 Signed-off-by: Akihiro Sagawa Signed-off-by: Alexandre Julliard --- dlls/ntdll/unix/system.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 8add2cabd4f..a889b2e020c 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -1742,12 +1742,31 @@ static BOOL match_tz_info( const RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi, match_tz_date(&tzi->DaylightDate, ®_tzi->DaylightDate)); } +static BOOL match_past_tz_bias( time_t past_time, LONG past_bias ) +{ + LONG bias; + struct tm *tm; + if (!past_time) return TRUE; + + tm = gmtime( &past_time ); + bias = (LONG)(mktime(tm) - past_time) / 60; + return bias == past_bias; +} + static BOOL match_tz_name( const char *tz_name, const RTL_DYNAMIC_TIME_ZONE_INFORMATION *reg_tzi ) { - static const struct { WCHAR key_name[32]; const char *short_name; } mapping[] = + static const struct { + WCHAR key_name[32]; + const char *short_name; + time_t past_time; + LONG past_bias; + } + mapping[] = { + { {'N','o','r','t','h',' ','K','o','r','e','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e',0 }, + "KST", 1451606400 /* 2016-01-01 00:00:00 UTC */, -510 }, { {'K','o','r','e','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e',0 }, - "KST" }, + "KST", 1451606400 /* 2016-01-01 00:00:00 UTC */, -540 }, { {'T','o','k','y','o',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e',0 }, "JST" }, { {'Y','a','k','u','t','s','k',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e',0 }, @@ -1759,7 +1778,8 @@ static BOOL match_tz_name( const char *tz_name, const RTL_DYNAMIC_TIME_ZONE_INFO for (i = 0; i < ARRAY_SIZE(mapping); i++) { if (!wcscmp( mapping[i].key_name, reg_tzi->TimeZoneKeyName )) - return !strcmp( mapping[i].short_name, tz_name ); + return !strcmp( mapping[i].short_name, tz_name ) + && match_past_tz_bias( mapping[i].past_time, mapping[i].past_bias ); } return TRUE; }