Akihiro Sagawa : ntdll: Add a timezone mapping rule for North Korea Standard Time.
Alexandre Julliard
julliard at winehq.org
Tue Dec 1 15:40:35 CST 2020
Module: wine
Branch: master
Commit: 22612bcff5ecc7ece4acc4325aa8b19e6129b2cf
URL: https://source.winehq.org/git/wine.git/?a=commit;h=22612bcff5ecc7ece4acc4325aa8b19e6129b2cf
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Mon Nov 30 22:00:34 2020 +0900
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 <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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;
}
More information about the wine-cvs
mailing list