Follow

Time Zone configuration and synchronization


Most operating systems report time using four parts:

  1. Clock
  2. Standard
  3. Time Zone
  4. Daylight Savings

Default system behaviour is to maintain two clocks, a system and a hardware clock.

The hardware clock is maintained regardless of power state by an internal circuit and guarantees a system will have accurate time even after having been disconnected from mains power. In case of a Virtual Machine this is provided by the host hypervisor OS.

The system clock is maintained by the Operating System, at boot time it will get it's value from the hardware clock and upon shutdown it will write to the hardware clock.

There are two standards for storing system time, either what's referred to as localtime or UTC. In the case of localtime the system uses the local time of the Operating System whilst UTC assumes that both the system and hardware (CMOS) clocks use UTC. We highly recommend using UTC at this keeps all clocks in sync and removes ambiguity, especially with containers and virtualization platforms having multiple timezones and frequently out of date timezone definitions.

It's highly recommended that the system clock is kept up to date with a time synchronization daemon such as NTP, providing time via virtualization platforms might not be sufficient because depending on implementation they might only offer synchronization at boot time or adjust in large increments or even move the clock backwards which can lead to unexpected results.*

It's highly recommended that any server/virtual machine/container running SDElements be set to use UTC (GMT) without any daylight savings. This preemptively prevents issues which can arise from such events as having the same time arrive twice with daylight savings switches or skipping an hour.

Note that this will not affect times displayed to users accessing the SDElements application via a web browser since all dates/time will be automatically converted to the appropriate timezone configured for the browser.

Services that are know to be affected by changes and mismatches in time include: 

  • SAML
  • Kerberos
  • Updates (anything signed with a crypto/GPG key)
  • Encryption, (signatures and dates need to match up and be in the past)


Do determine the current timezone on your server use the "date" command, it should return a value similar to the following which indicates the configured timezone, example:

[user@sdecentos6 ~]$ date

Tue Sep  1 20:25:54 UTC 2016

To change the currently configured time zone, daylight savings and standard change the following values.

Centos/RHEL v. 6.X

To list all available timezones list the files under the /usr/share/zoneinfo directory, note you might need to recurse into subdirectories as needed.

ls /usr/share/zoneinfo


Edit the file /etc/sysconfig/clock , it supports several attributes but only 2 are relevant:

  • ZONE - The name of the timezone file to use
  • UTC - A boolean value indicating if the system clock uses UTC
Example (not recommended):
ZONE="Asia/Shanghai"
UTC=false

Example (recommended):

ZONE="UTC"
UTC=true


Copy the correct timezone file from /usr/share/zoneinfo to /etc/localtime:

Example (rot recommended):

cp/usr/share/zoneinfo/Australia/Melbourne /etc/localtime
Example (recommended)
cp /usr/share/zoneinfo/UTC /etc/localtime


Confirm the correct time zone has been set using the date command, example:

[user@sdecentos6 ~]$ date

Tue Sep  1 20:25:54 UTC 2016

Synchronize the hardware clock with the system clock

Example (not recommended):

hwclock --systohc --localtime

Example (recommended):

hwclock --systohc --utc




Centos/RHEL v 7.x

To list all available timezones:

timedatectl list-timezones

To change your timezone:

timedatectl set-timezone UTC

Confirm the correct time zone has been set using the date command, example:

[user@sdecentos6 ~]$ date

Tue Sep  1 20:25:54 UTC 2016



Ubuntu 10+

Confirm the correct time zone has been set using the date command, example:

[user@sdeubuntu12 ~]$ date

Tue Sep  1 20:25:54 UTC 2016


To change the current timezone use the interactive wizard:

sudo dpkg-reconfigure tzdata


*Daemons such as NTP never move the clock backwards but simply slow it down until it syncs up.


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments