Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a8793a2c
Commit
a8793a2c
authored
Apr 29, 2019
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19243 Fix timezone handling on Windows to report standard timezone names
parent
ba9f8776
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
13 deletions
+183
-13
sql/gen_win_tzname_data.ps1
sql/gen_win_tzname_data.ps1
+11
-0
sql/mysqld.cc
sql/mysqld.cc
+36
-13
sql/win_tzname_data.h
sql/win_tzname_data.h
+136
-0
No files found.
sql/gen_win_tzname_data.ps1
0 → 100644
View file @
a8793a2c
# Generates a header file for converting between Windows timezone names to tzdb names
# using CLDR data.
# Usage: powershell -File gen_win_tzname_data.ps1 > win_tzname_data.h
write-output
"/* This file was generated using gen_win_tzname_data.ps1 */"
$xdoc
=
new-object
System.Xml.XmlDocument
$xdoc
.
load
(
"https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml"
)
$nodes
=
$xdoc
.
SelectNodes
(
"//mapZone[@territory='001']"
)
# use default territory (001)
foreach
(
$node
in
$nodes
)
{
write-output
(
'{L"'
+
$node
.
other
+
'","'
+
$node
.
type
+
'"},'
)
}
sql/mysqld.cc
View file @
a8793a2c
...
@@ -4009,6 +4009,39 @@ static int init_early_variables()
...
@@ -4009,6 +4009,39 @@ static int init_early_variables()
return
0
;
return
0
;
}
}
#ifdef _WIN32
static
void
get_win_tzname
(
char
*
buf
,
size_t
size
)
{
static
struct
{
const
wchar_t
*
windows_name
;
const
char
*
tzdb_name
;
}
tz_data
[]
=
{
#include "win_tzname_data.h"
{
0
,
0
}
};
DYNAMIC_TIME_ZONE_INFORMATION
tzinfo
;
if
(
GetDynamicTimeZoneInformation
(
&
tzinfo
)
==
TIME_ZONE_ID_UNKNOWN
)
{
strncpy
(
buf
,
"unknown"
,
size
);
return
;
}
for
(
size_t
i
=
0
;
tz_data
[
i
].
windows_name
;
i
++
)
{
if
(
wcscmp
(
tzinfo
.
TimeZoneKeyName
,
tz_data
[
i
].
windows_name
)
==
0
)
{
strncpy
(
buf
,
tz_data
[
i
].
tzdb_name
,
size
);
return
;
}
}
wcstombs
(
buf
,
tzinfo
.
TimeZoneKeyName
,
size
);
buf
[
size
-
1
]
=
0
;
return
;
}
#endif
static
int
init_common_variables
()
static
int
init_common_variables
()
{
{
...
@@ -4053,23 +4086,13 @@ static int init_common_variables()
...
@@ -4053,23 +4086,13 @@ static int init_common_variables()
if
(
ignore_db_dirs_init
())
if
(
ignore_db_dirs_init
())
return
1
;
return
1
;
#ifdef _WIN32
#ifdef HAVE_TZNAME
get_win_tzname
(
system_time_zone
,
sizeof
(
system_time_zone
));
#elif defined(HAVE_TZNAME)
struct
tm
tm_tmp
;
struct
tm
tm_tmp
;
localtime_r
(
&
server_start_time
,
&
tm_tmp
);
localtime_r
(
&
server_start_time
,
&
tm_tmp
);
const
char
*
tz_name
=
tzname
[
tm_tmp
.
tm_isdst
!=
0
?
1
:
0
];
const
char
*
tz_name
=
tzname
[
tm_tmp
.
tm_isdst
!=
0
?
1
:
0
];
#ifdef _WIN32
/*
Time zone name may be localized and contain non-ASCII characters,
Convert from ANSI encoding to UTF8.
*/
wchar_t
wtz_name
[
sizeof
(
system_time_zone
)];
mbstowcs
(
wtz_name
,
tz_name
,
sizeof
(
system_time_zone
)
-
1
);
WideCharToMultiByte
(
CP_UTF8
,
0
,
wtz_name
,
-
1
,
system_time_zone
,
sizeof
(
system_time_zone
)
-
1
,
NULL
,
NULL
);
#else
strmake_buf
(
system_time_zone
,
tz_name
);
strmake_buf
(
system_time_zone
,
tz_name
);
#endif
/* _WIN32 */
#endif
/* HAVE_TZNAME */
#endif
/* HAVE_TZNAME */
/*
/*
...
...
sql/win_tzname_data.h
0 → 100644
View file @
a8793a2c
/* This file was generated using gen_win_tzname_data.ps1 */
{
L"Dateline Standard Time"
,
"Etc/GMT+12"
},
{
L"UTC-11"
,
"Etc/GMT+11"
},
{
L"Aleutian Standard Time"
,
"America/Adak"
},
{
L"Hawaiian Standard Time"
,
"Pacific/Honolulu"
},
{
L"Marquesas Standard Time"
,
"Pacific/Marquesas"
},
{
L"Alaskan Standard Time"
,
"America/Anchorage"
},
{
L"UTC-09"
,
"Etc/GMT+9"
},
{
L"Pacific Standard Time (Mexico)"
,
"America/Tijuana"
},
{
L"UTC-08"
,
"Etc/GMT+8"
},
{
L"Pacific Standard Time"
,
"America/Los_Angeles"
},
{
L"US Mountain Standard Time"
,
"America/Phoenix"
},
{
L"Mountain Standard Time (Mexico)"
,
"America/Chihuahua"
},
{
L"Mountain Standard Time"
,
"America/Denver"
},
{
L"Central America Standard Time"
,
"America/Guatemala"
},
{
L"Central Standard Time"
,
"America/Chicago"
},
{
L"Easter Island Standard Time"
,
"Pacific/Easter"
},
{
L"Central Standard Time (Mexico)"
,
"America/Mexico_City"
},
{
L"Canada Central Standard Time"
,
"America/Regina"
},
{
L"SA Pacific Standard Time"
,
"America/Bogota"
},
{
L"Eastern Standard Time (Mexico)"
,
"America/Cancun"
},
{
L"Eastern Standard Time"
,
"America/New_York"
},
{
L"Haiti Standard Time"
,
"America/Port-au-Prince"
},
{
L"Cuba Standard Time"
,
"America/Havana"
},
{
L"US Eastern Standard Time"
,
"America/Indianapolis"
},
{
L"Paraguay Standard Time"
,
"America/Asuncion"
},
{
L"Atlantic Standard Time"
,
"America/Halifax"
},
{
L"Venezuela Standard Time"
,
"America/Caracas"
},
{
L"Central Brazilian Standard Time"
,
"America/Cuiaba"
},
{
L"SA Western Standard Time"
,
"America/La_Paz"
},
{
L"Pacific SA Standard Time"
,
"America/Santiago"
},
{
L"Turks And Caicos Standard Time"
,
"America/Grand_Turk"
},
{
L"Newfoundland Standard Time"
,
"America/St_Johns"
},
{
L"Tocantins Standard Time"
,
"America/Araguaina"
},
{
L"E. South America Standard Time"
,
"America/Sao_Paulo"
},
{
L"SA Eastern Standard Time"
,
"America/Cayenne"
},
{
L"Argentina Standard Time"
,
"America/Buenos_Aires"
},
{
L"Greenland Standard Time"
,
"America/Godthab"
},
{
L"Montevideo Standard Time"
,
"America/Montevideo"
},
{
L"Magallanes Standard Time"
,
"America/Punta_Arenas"
},
{
L"Saint Pierre Standard Time"
,
"America/Miquelon"
},
{
L"Bahia Standard Time"
,
"America/Bahia"
},
{
L"UTC-02"
,
"Etc/GMT+2"
},
{
L"Azores Standard Time"
,
"Atlantic/Azores"
},
{
L"Cape Verde Standard Time"
,
"Atlantic/Cape_Verde"
},
{
L"UTC"
,
"Etc/GMT"
},
{
L"GMT Standard Time"
,
"Europe/London"
},
{
L"Greenwich Standard Time"
,
"Atlantic/Reykjavik"
},
{
L"W. Europe Standard Time"
,
"Europe/Berlin"
},
{
L"Central Europe Standard Time"
,
"Europe/Budapest"
},
{
L"Romance Standard Time"
,
"Europe/Paris"
},
{
L"Morocco Standard Time"
,
"Africa/Casablanca"
},
{
L"Sao Tome Standard Time"
,
"Africa/Sao_Tome"
},
{
L"Central European Standard Time"
,
"Europe/Warsaw"
},
{
L"W. Central Africa Standard Time"
,
"Africa/Lagos"
},
{
L"Jordan Standard Time"
,
"Asia/Amman"
},
{
L"GTB Standard Time"
,
"Europe/Bucharest"
},
{
L"Middle East Standard Time"
,
"Asia/Beirut"
},
{
L"Egypt Standard Time"
,
"Africa/Cairo"
},
{
L"E. Europe Standard Time"
,
"Europe/Chisinau"
},
{
L"Syria Standard Time"
,
"Asia/Damascus"
},
{
L"West Bank Standard Time"
,
"Asia/Hebron"
},
{
L"South Africa Standard Time"
,
"Africa/Johannesburg"
},
{
L"FLE Standard Time"
,
"Europe/Kiev"
},
{
L"Israel Standard Time"
,
"Asia/Jerusalem"
},
{
L"Kaliningrad Standard Time"
,
"Europe/Kaliningrad"
},
{
L"Sudan Standard Time"
,
"Africa/Khartoum"
},
{
L"Libya Standard Time"
,
"Africa/Tripoli"
},
{
L"Namibia Standard Time"
,
"Africa/Windhoek"
},
{
L"Arabic Standard Time"
,
"Asia/Baghdad"
},
{
L"Turkey Standard Time"
,
"Europe/Istanbul"
},
{
L"Arab Standard Time"
,
"Asia/Riyadh"
},
{
L"Belarus Standard Time"
,
"Europe/Minsk"
},
{
L"Russian Standard Time"
,
"Europe/Moscow"
},
{
L"E. Africa Standard Time"
,
"Africa/Nairobi"
},
{
L"Iran Standard Time"
,
"Asia/Tehran"
},
{
L"Arabian Standard Time"
,
"Asia/Dubai"
},
{
L"Astrakhan Standard Time"
,
"Europe/Astrakhan"
},
{
L"Azerbaijan Standard Time"
,
"Asia/Baku"
},
{
L"Russia Time Zone 3"
,
"Europe/Samara"
},
{
L"Mauritius Standard Time"
,
"Indian/Mauritius"
},
{
L"Saratov Standard Time"
,
"Europe/Saratov"
},
{
L"Georgian Standard Time"
,
"Asia/Tbilisi"
},
{
L"Caucasus Standard Time"
,
"Asia/Yerevan"
},
{
L"Afghanistan Standard Time"
,
"Asia/Kabul"
},
{
L"West Asia Standard Time"
,
"Asia/Tashkent"
},
{
L"Ekaterinburg Standard Time"
,
"Asia/Yekaterinburg"
},
{
L"Pakistan Standard Time"
,
"Asia/Karachi"
},
{
L"India Standard Time"
,
"Asia/Calcutta"
},
{
L"Sri Lanka Standard Time"
,
"Asia/Colombo"
},
{
L"Nepal Standard Time"
,
"Asia/Katmandu"
},
{
L"Central Asia Standard Time"
,
"Asia/Almaty"
},
{
L"Bangladesh Standard Time"
,
"Asia/Dhaka"
},
{
L"Omsk Standard Time"
,
"Asia/Omsk"
},
{
L"Myanmar Standard Time"
,
"Asia/Rangoon"
},
{
L"SE Asia Standard Time"
,
"Asia/Bangkok"
},
{
L"Altai Standard Time"
,
"Asia/Barnaul"
},
{
L"W. Mongolia Standard Time"
,
"Asia/Hovd"
},
{
L"North Asia Standard Time"
,
"Asia/Krasnoyarsk"
},
{
L"N. Central Asia Standard Time"
,
"Asia/Novosibirsk"
},
{
L"Tomsk Standard Time"
,
"Asia/Tomsk"
},
{
L"China Standard Time"
,
"Asia/Shanghai"
},
{
L"North Asia East Standard Time"
,
"Asia/Irkutsk"
},
{
L"Singapore Standard Time"
,
"Asia/Singapore"
},
{
L"W. Australia Standard Time"
,
"Australia/Perth"
},
{
L"Taipei Standard Time"
,
"Asia/Taipei"
},
{
L"Ulaanbaatar Standard Time"
,
"Asia/Ulaanbaatar"
},
{
L"Aus Central W. Standard Time"
,
"Australia/Eucla"
},
{
L"Transbaikal Standard Time"
,
"Asia/Chita"
},
{
L"Tokyo Standard Time"
,
"Asia/Tokyo"
},
{
L"North Korea Standard Time"
,
"Asia/Pyongyang"
},
{
L"Korea Standard Time"
,
"Asia/Seoul"
},
{
L"Yakutsk Standard Time"
,
"Asia/Yakutsk"
},
{
L"Cen. Australia Standard Time"
,
"Australia/Adelaide"
},
{
L"AUS Central Standard Time"
,
"Australia/Darwin"
},
{
L"E. Australia Standard Time"
,
"Australia/Brisbane"
},
{
L"AUS Eastern Standard Time"
,
"Australia/Sydney"
},
{
L"West Pacific Standard Time"
,
"Pacific/Port_Moresby"
},
{
L"Tasmania Standard Time"
,
"Australia/Hobart"
},
{
L"Vladivostok Standard Time"
,
"Asia/Vladivostok"
},
{
L"Lord Howe Standard Time"
,
"Australia/Lord_Howe"
},
{
L"Bougainville Standard Time"
,
"Pacific/Bougainville"
},
{
L"Russia Time Zone 10"
,
"Asia/Srednekolymsk"
},
{
L"Magadan Standard Time"
,
"Asia/Magadan"
},
{
L"Norfolk Standard Time"
,
"Pacific/Norfolk"
},
{
L"Sakhalin Standard Time"
,
"Asia/Sakhalin"
},
{
L"Central Pacific Standard Time"
,
"Pacific/Guadalcanal"
},
{
L"Russia Time Zone 11"
,
"Asia/Kamchatka"
},
{
L"New Zealand Standard Time"
,
"Pacific/Auckland"
},
{
L"UTC+12"
,
"Etc/GMT-12"
},
{
L"Fiji Standard Time"
,
"Pacific/Fiji"
},
{
L"Chatham Islands Standard Time"
,
"Pacific/Chatham"
},
{
L"UTC+13"
,
"Etc/GMT-13"
},
{
L"Tonga Standard Time"
,
"Pacific/Tongatapu"
},
{
L"Samoa Standard Time"
,
"Pacific/Apia"
},
{
L"Line Islands Standard Time"
,
"Pacific/Kiritimati"
},
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment