Getting/Setting the system timezone
jtate at dragonstrider.com
Tue Apr 8 11:21:21 PDT 2008
We went through this whole debate internally here at rPath. I think we
settled on a copy so that your timezone could be set even if only / could be
mounted (and /usr was a separate partition). This is problematic though, for
example when the meaning of Daylight Saving Time changes. We now use
tzdata-update when we do an update to copy new files into place.
According to the FSB, /usr/share is the right place for zoneinfo files on
*NIX, since they can be shared across multiple machines, but that is
problematic if your system clock is not UTC and you have to boot to single
user mode (or equivalent) and a copy of the system's timezone isn't present
on the / filesystem. How does Debian get around this problem?
On Tuesday 08 April 2008 12:37:32 Vincent Untz wrote:
> I'm having fun with some code to get/set the system timezone. It seems
> people like to change how things work :-) Here's what I have so far.
> There are probably some errors, and I might miss some stuff...
> + timezone data files are in:
> - /usr/share/zoneinfo for Linux distros (and *BSD?)
> - /usr/share/lib/zoneinfo/tab for OpenSolaris
> + /etc/localtime contains the binary data of the timezone. Sometimes
> it's a copy of a file from /usr/share/zoneinfo, sometimes it's a soft
> link, sometimes it's a hard link (which is bad since /etc and /usr
> can be on different partitions)
> If it's a soft link, it's easy to read the link to know which file is
> used for the timezone.
> If it's a hard link, we can find the right file by comparing inodes.
> + what is the right way to set /etc/localtime? I think copying the file
> is the best thing to do, but I have no idea if that's what all distro
> + the timezone is also described in:
> - Fedora/Mandriva: /etc/sysconfig/clock (needs to be parsed to get
> the ZONE= line)
> - openSUSE: /etc/sysconfig/clock (same but with TIMEZONE=)
> - Debian/Ubuntu: /etc/timezone (only contains the name of the
> - openSolaris: (not sure, guessing from some code I have):
> /etc/TIMEZONE (needs to be parsed to get the TZ= line)
> So, if I want to set the timezone, I have to change /etc/localtime
> (easy) and then to do something which is distro-specific.
> First, if your distro is working in a different way, can you tell me
> about it?
> And second, could we improve this? :-) It's really painful right now...
> I'm sure there are other similar system settings that are hard to manage
> for the same reason, but the timezone should be easy to solve if we
More information about the Distributions