Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-29102

system_time_zone is incorrect on Windows when TZ is set

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.6.8
    • 10.6.11, 10.7.7, 10.8.6, 10.9.4, 10.10.2
    • Variables
    • None
    • Microsoft Windows [Version 10.0.18363.2274]
      official MSI build

    Description

      On Windows, the global variable system_time_zone doesn't properly reflect the used time zone when the environment variable TZ is set.

      For example, on my system configured for region Germany, but TZ is set as "CST-8":
      SELECT @@time_zone, @@system_time_zone, TIMEDIFF(NOW(), UTC_TIMESTAMP());
      SYSTEM Europe/Berlin 08:00:00
      Whereas in Linux it returns
      SYSTEM CST 08:00:00

      Attachments

        Issue Links

          Activity

            sweiser a question

            From documentation (emphasis mine)

            If you are using a Unix-like operating system, then you can set the system time zone by setting the TZ environment variable in your shell before starting the server. For example:
            $ export TZ='America/New_York'
            $ service mysql start

            You are not using Unix-like operating system, why would you expect that to work?

            wlad Vladislav Vaintroub added a comment - sweiser a question From documentation (emphasis mine) If you are using a Unix-like operating system , then you can set the system time zone by setting the TZ environment variable in your shell before starting the server. For example: $ export TZ='America/New_York' $ service mysql start You are not using Unix-like operating system, why would you expect that to work?

            I didn't expect anything, not even that this part of the documentation (which I did read in advance) is up-to-date, so I just tried it. And what I see is that it works in parts (MariaDB does apply the time zone, it just doesn't reflect it in the variable system_time_zone), so I assumed that it is a bug.

            If I understand your comment correctly, the fact that is somewhat working right now is "an accident" and not intended. So maybe this should be better as a "task": "make TZ variable work properly on Windows too".

            I would still point out that the current behavior is somewhat inconsistent, especially because the TZ variable might be deliberately or accidentally set to something even on Windows systems (for example, some old versions of Cygwin did set it during installation). That being said, if the solution to it being inconsistent would be to remove the current behavior entirely, that would make me sad.

            sweiser Sebastian Weiser added a comment - I didn't expect anything, not even that this part of the documentation (which I did read in advance) is up-to-date, so I just tried it. And what I see is that it works in parts (MariaDB does apply the time zone, it just doesn't reflect it in the variable system_time_zone), so I assumed that it is a bug. If I understand your comment correctly, the fact that is somewhat working right now is "an accident" and not intended. So maybe this should be better as a "task": "make TZ variable work properly on Windows too". I would still point out that the current behavior is somewhat inconsistent, especially because the TZ variable might be deliberately or accidentally set to something even on Windows systems (for example, some old versions of Cygwin did set it during installation). That being said, if the solution to it being inconsistent would be to remove the current behavior entirely, that would make me sad.

            People

              wlad Vladislav Vaintroub
              sweiser Sebastian Weiser
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.