summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-10-17 12:39:25 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-10-17 12:39:25 +0200
commitd86ad1f127fdc71e888e2e168b99f561f111a0b2 (patch)
treedf05decbc411609ddb875c371cf2549b0a4aaa26 /sql/mysqld.cc
parent069552a41d27b44016f54225af1c172b7df4e8bb (diff)
parentf3fddc1b4a3d05167303a87b04be985b17096a46 (diff)
downloadmariadb-git-d86ad1f127fdc71e888e2e168b99f561f111a0b2.tar.gz
Merge branch '10.8' into 10.9
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 658d65a1830..1da09ac9541 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3905,14 +3905,24 @@ static int init_common_variables()
if (ignore_db_dirs_init())
exit(1);
-#ifdef _WIN32
- get_win_tzname(system_time_zone, sizeof(system_time_zone));
-#elif defined(HAVE_TZNAME)
struct tm tm_tmp;
- localtime_r(&server_start_time,&tm_tmp);
- const char *tz_name= tzname[tm_tmp.tm_isdst != 0 ? 1 : 0];
- strmake_buf(system_time_zone, tz_name);
-#endif /* HAVE_TZNAME */
+ localtime_r(&server_start_time, &tm_tmp);
+
+#ifdef HAVE_TZNAME
+#ifdef _WIN32
+ /*
+ If env.variable TZ is set, derive timezone name from it.
+ Otherwise, use IANA tz name from get_win_tzname.
+ */
+ if (!getenv("TZ"))
+ get_win_tzname(system_time_zone, sizeof(system_time_zone));
+ else
+#endif
+ {
+ const char *tz_name= tzname[tm_tmp.tm_isdst != 0 ? 1 : 0];
+ strmake_buf(system_time_zone, tz_name);
+ }
+#endif
/*
We set SYSTEM time zone as reasonable default and