[MDEV-17277] Timezone = UTC Created: 2018-09-23  Updated: 2021-04-20  Resolved: 2018-09-24

Status: Closed
Project: MariaDB Server
Component/s: Time zones
Affects Version/s: 10.1.35
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Olaf van der Spek Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Debian



 Description   

1. How does one set timezone to UTC?
2. Could this be made the default?

[mysqld]
default-time-zone = UTC

[ERROR] Fatal error: Illegal or unknown default time zone 'UTC'

MariaDB [(none)]> show variables like '%zone%';

Variable_name Value
system_time_zone CEST
time_zone SYSTEM


 Comments   
Comment by Alice Sherepa [ 2018-09-24 ]

To use names like "UTC" you have to populate the timezone table, which can be done by using mysql_tzinfo_to_sql (https://mariadb.com/kb/en/library/mysql_tzinfo_to_sql/).
If you haven't done it, try "default-time-zone=+00:00" instead.

Comment by Olaf van der Spek [ 2018-09-24 ]

> system_time_zone = CEST

How come CEST is set here if names aren't available / supported?

> 2. Could this be made the default?

^

Comment by Olaf van der Spek [ 2018-09-27 ]

Alice?

Comment by Alice Sherepa [ 2018-09-27 ]

Named timezones are usable when they exist in your mysql database. In other cases it is 1) SYSTEM(the default, on your machine it is CEST), like

:~$ date
Thu Sep 27 15:03:37 CEST 2018

2) offset from UTC, such as +5:00 or -9:00.
Currently, there are no plans to change this behavior.

Comment by Olaf van der Spek [ 2018-09-27 ]

How does this deal with summer times? Would it be applying summer time even for dates that are in winter?

> Currently, there are no plans to change this behavior.

Could you reconsider?

Comment by Alice Sherepa [ 2018-09-27 ]

UTC does not change with a change of seasons ("universal")
MariaDB stores values internally in UTC, converting them to the required time zone as required
JIRA is a bugtracker, it is not a place to seek help, please use public forums instead.

Comment by Olaf van der Spek [ 2018-09-27 ]

> UTC does not change with a change of seasons ("universal")

I know UTC doesn't.. I'm talking about CEST (from system) when named time zones aren't available to MariaDB.

> JIRA is a bugtracker, it is not a place to seek help, please use public forums instead.

And this is a feature request to change the default to UTC..

Comment by Olaf van der Spek [ 2021-03-18 ]

Ping

Comment by Sergei Golubchik [ 2021-03-24 ]

according to https://mariadb.com/kb/en/time-zones/ there are three ways to specify a time zone:

  • a special keyword SYSTEM
  • an offset from UTC, such as +5:00 or -9:00
  • a named time zone, if the time zone tables were loaded

that is, if you want UTC, you can use --default-time-zone=+0:0 — this doesn't use time zone names

Comment by Olaf van der Spek [ 2021-04-03 ]

> an offset from UTC, such as +5:00 or -9:00

An offset isn't a time zone of course, so maybe this should be deprecated?

> --default-time-zone=+0:0

Could this be made the default?

Comment by Sergei Golubchik [ 2021-04-05 ]

First, an offset is a valid timezone specification, not only in MariaDB:

$ date
Mon Apr  5 14:00:01 CEST 2021
$ TZ=EST date
Mon Apr  5 07:00:05 EST 2021
$ TZ=FOO-10:30 date
Mon Apr  5 22:30:10 FOO 2021

See, the last one specifies a fictional timezone called "FOO" with the UTC offset of 10:30

Second, I doubt we can make UTC a default, it'll break applications for majority of our users

Comment by Olaf van der Spek [ 2021-04-05 ]

> First, an offset is a valid timezone specification, not only in MariaDB:

Sure, but any (real) time zone with DST can't be specified with just an offset, can it?

> Second, I doubt we can make UTC a default, it'll break applications for majority of our users

The majority of users depend on the default time zone being system? Hmm...

Could the "default-time-zone=+0:0" setting be included as a comment in the stock conf then?

Comment by Sergei Golubchik [ 2021-04-20 ]

A real time zone without DST can, but I understand, you mean that DST cannot be specified that way. You're right.

Yes, I think it could be. But practically, based on our feedback data, less than 0.2% of users change the default time zone from SYSTEM. So it's likely do more harm (confusion) than good (help).

Comment by Olaf van der Spek [ 2021-04-20 ]

> But practically, based on our feedback data, less than 0.2% of users change the default time zone from SYSTEM.

I've seen code adjusting times from UTC to local before sending it to the DB and from local to UTC after...
Maybe I just don't properly understand time zone handling in the DB, but I doubt I'm the only one.

> So it's likely do more harm (confusion) than good (help).

Why would "default-time-zone=+0:0" as a comment be confusing?
Explicitly setting default-time-zone=system in the conf would be good too, as IMO it's a non-obvious default.

Generated at Thu Feb 08 08:35:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.