I am administering a CentOS 6 Linux OS.

I want to remove all explicit timezone information where such information may cause anything but UTC timezone for the system. This is because it is a template of a virtual machine, and also because it has been decided to have the default timezone as UTC.

Do I have to change the /etc/sysconfig/clock file (I assume this is CentOS specific configuration entity), or /etc/localtime, or both? Can I remove both, and will it then fall back to UTC or some other intrinsic defaults? I just cannot find documentation on how the system behaves without these files, for instance. Or maybe I should not be removing either, but then why is there a timezone preference distributed over two files? Unless it has slightly different meaning in each?

I can test empirically of course, but I may change the distro in the future, and then will have another timezone again, while my scripts try to shoot for distro-neutral compatibility.


The default timezone is no timezone, that is, UTC time. There is no hardcoded zone information as it could very quickly become incorrect/obsolete.

The kernel clock always runs on UTC (or at least what it thinks is UTC). By default, it expects to read UTC time from the hardware clock (RTC), but allows the boot process to specify the correct "local time" offset, as most PCs keep local time in the RTC.

Userspace works with UTC-based "epoch" timestamps, but reads /etc/localtime or the $TZ environment variable when displaying the dates. If neither exists, you'll get UTC.

You can also explicitly set them to "UTC" or "Etc/UTC" if you want (e.g. export TZ=UTC to temporarily override the system-wide zone).

Some distributions split the configuration since zoneinfo files themselves don't have the zone name inside, so once the admin copied /usr/share/zoneinfo/Europe/London to /etc/localtime, it is no longer possible to know that it was "Europe/London".

For example, the name is needed when showing the current zone in setup screens, or when updating the localtime file on every boot (it needs to be copied to /etc again every time zoneinfo is updated).

Other distributions solve this by symlinking the zoneinfo file instead, and reading the symlink's target. This however needs /usr to be mounted very early, which is disliked by graybeards.

The configuration files are not portable; /etc/sysconfig is specific to Red Hat (Debian has /etc/default). However, on systemd systems the symlink approach is always used, and there is a timedatectl set-timezone tool for changing it.

| improve this answer | |
  • Very useful, thanks. But I read parts of your answer to be slightly contradictory - first you say that the default timezone is no timezone, but then say that if neither [configuration file] exists, I'll get UTC. – amn Apr 21 '15 at 8:40
  • 1
    @amn: It's the same thing. All other timezones are specified as an offset on top of UTC time. On Linux, zdump -v UTC will show that it has no adjustments. – user1686 Apr 21 '15 at 8:42
  • Ok, well in my case my /etc/sysconfig/clock has been empty for a while, since I assumed removing ZONE variable will help me fall back to UTC. But after observing date giving me time in EDT (I had no own TZ in my environment), I tracked it down to /etc/localtime file, which appears to be carrying the data for EDT timezone (not a symlink, but matches MD5 signature of /usr/share/zoneinfo/US/Eastern and a couple of others). I thought /etc/sysconfig/clock causes the system to update /etc/localtime automatically. Maybe it only does so when the former actually contains any text? – amn Apr 21 '15 at 8:50
  • Well yes, the boot process can't really guess the correct zoneinfo file if the config is empty. (Even hunting down by hash wouldn't work, since the whole point is to update the file when it's changed.) – user1686 Apr 21 '15 at 8:58

In my line of work, machines move physically around the world from time to time, so association with a timezone would just cause problems.

What I do, as I'm a big fan of UTC too, is set the timezone to Reykjavik. This results in UTC +0, without that pesky DST.

What you do to change this when needed, is to symlink /etc/localtime to whatever suitable timezone definition in /usr/share/zoneinfo/. I'm not sure if this is CentOS-specific either, we just happen to use a lot of CentOS servers.

| improve this answer | |
  • As opposed to setting the timezone to just UTC? – user1686 Apr 21 '15 at 8:59
  • @grawity I've seen systems that do not have a definition for UTC. – Jarmund Apr 21 '15 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.