Setting gateway timezone on Linux

I’m trying to change the timezone on an Ignition 8.1.10 server. It is currently ‘America/Chicago’, but we want to fix it on CST year round. I’ve created a /etc/localtime link to /usr/share/zoneinfo/Etc/GMT+6 and this seems to work fine - MariaDB sees its time correctly.

However, Ignition still reports its timezone in the ‘Gateway/Timezone’ server tag as ‘America/Chicago’. Setting clients to the Gateway timezone results in them showing CDT, not CST. Restarting Ignition and rebooting the server has had no effect. I’m concerned gateway scripts are going to trigger at the wrong time.

Does anyone know where the timezone of the server is set?

You can force the timezone by setting -Duser.timezone in ignition.conf, but it might be best to figure out why the JVM on your system isn’t picking up the change you made…

What distro, what version of Ignition/Java, and do you already have a timezone being set in ignition.conf by chance?

1 Like

Distro is Debian 10.11
Ignition is 8.1.10
Java is built-in Azul 11.0.11

No timezone is being set in ignition.conf as far as I can see. I can force clients to ‘Etc/GMT+6’ but the server timezone is still reported as ‘America/Chicago’.

I’m having trouble finding concrete documentation on how the JVM looks up the timezone on Linux, but I did find this somewhere:

  1. JVM uses the environment variable TZ if it is set.
  2. If TZ is not set, then JVM looks for the file /etc/sysconfig/clock and finds the ZONE entry.
  3. If neither TZ nor ZONE is set, JVM compares the contents of /etc/localtime to the files in /usr/share/zoneinfo looking for a match. The matching path and filename under /usr/share/zoneinfo provides the time zone.

and another:

  1. Find TZ environment.
  2. Read /etc/timezone .
  3. Read /etc/localtime . If it is a soft link(ex: /usr/share/zoneinfo/Asia/Shanghai ), return timezone by path. Otherwise, compare the content with all files in /usr/share/zoneinfo , if found, return timezone.
  4. Return GMT as timezone.

Seems that /etc/timezone may take precedence over /etc/localtime, might check that.

2 Likes

Spot on Kevin, it looks like /etc/timezone does indeed take precedence over /etc/localtime for the JVM. When I changed that to ‘Etc/GMT+6’ and restarted Ignition it all looks to be working fine.

Thanks for your help!

Verified as much in the source too: openjdk-jdk11u/TimeZone_md.c at 4f9c8c4c48683a77655faa63c23da2f77cb208d0 · AdoptOpenJDK/openjdk-jdk11u · GitHub

Seems to be Debian-specific?