summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-10-16 21:40:33 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-10-16 21:40:33 +0200
commitec2b30e7367fcd4b2af0d7ae42d7b83148a859a4 (patch)
treea74c8446a01f1dbd785d8c268e97698952711a67 /sql/mysqld.cc
parent8a9e17103bb6c111882fa6ec589e4fed4f07d389 (diff)
parent822694bd56a74eb4a81a85db683fe7b0837029ed (diff)
downloadmariadb-git-ec2b30e7367fcd4b2af0d7ae42d7b83148a859a4.tar.gz
Merge branch '10.6' into 10.7
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 91c88ccb73d..df24de9242f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3899,14 +3899,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