On my Manjaro linux box, I have a file /etc/timezone
which contains:
Asia/Bangkok
Another Manjaro forum user also has the same file. That thread on the whole contains some prior art on this question.
What's strange is that timedatectl status
doesn't use this file to report Region/City
. Here's the initial status:
$ timedatectl status
Local time: Fri 2018-06-29 11:01:28 +07
Universal time: Fri 2018-06-29 04:01:28 UTC
RTC time: Fri 2018-06-29 04:01:28
Time zone: Asia/Bangkok (+07, +0700)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no
Now I overwrite the /etc/localtime
symlink with contents of the file it points to:
$ sudo ln -f "$(realpath /etc/localtime)" /etc/localtime
$ timedatectl status
Local time: Fri 2018-06-29 04:04:03 UTC
Universal time: Fri 2018-06-29 04:04:03 UTC
RTC time: Fri 2018-06-29 04:04:04
Time zone: n/a (UTC, +0000)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no
Note the local time change to match UTC, and then/a
timezone.
So, timedatectl
doesn't read from /etc/timezone
, and timedatectl set-timezone
doesn't write to /etc/timezone
also.
Besides that guess, my /etc/timezone
is a mystery.
- What writes it?
- What reads it?
- What for?
Best Answer
GNU libc (and thus any non-embedded Linux), reads
/etc/localtime
to determine the system's time zone (the default timezone if not overridden by theTZ
environment variable or by an application-specific setting). *BSD does the same thing. Some embedded Linux systems do things differently./etc/localtime
should be a symbolic link to a file under/usr/share/zoneinfo/
. Normal applications don't mind, they only read the contents of the file, but system management utilities such astimedatectl
care more because they can also change the setting, and they would do that by changing the target of the symbolic link.Java does (or did?) things differently: it reads
/etc/timezone
, which contains a timezone name, which should be the path to a file relative to/usr/share/zoneinfo
. I'm not aware of any other program that uses/etc/timezone
, and I don't know why Sun chose to do things differently from the rest of the world.