Incorrect Server Time on the "Time Conditions" Page

As this took a while to discover, I figured I would document this for anyone else with this issue, and for my own future reference.

Symptoms:

  1. system time was correct and in the correct time zone.
  2. Using the “speaking clock” feature (*60 on this system), the time was correct.
  3. The “Server Time” displayed on the “Time Conditions” page was incorrect and off by exactly 2 hours.

Resolution:
Since the time was exactly 2 hours off it is clearly a time zone issue, however the issue has nothing to do with Asterisk. PHP has a separate time zone setting in “/etc/php.ini”.

Edit the php.ini file and modify the “date.timezone” parameter to match the system time zone as found in “/usr/share/zoneinfo/”

Example:

$ grep timezone /etc/php.ini
date.timezone = America/Chicago



If you are having any other time zone related issues, here are the standard settings for most Linux operating systems: (Examples all use US Central time zone)


  1. Create a symlink from the time zone file to “/etc/localtime”. you may need to delete the file if it already exists.

       $ ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
  2. Add a time zone environment variable.

  $ echo "export TZ=America/Chicago" >> /etc/profile
  1. On some Red Hat and similar systems, the time zone is also stored in “/etc/sysconfig/clock”. Edit this file and set the correct time zone.
  $ cat /etc/sysconfig/clock
  ZONE="America/Chicago"
  UTC=true[/color]
  ARC=false

Note that a reboot is required to completely enable the changes made to system time zone settings.

Works great!

On Debian systems you may need to run

diff -s /etc/localtime /usr/share/zoneinfo/cat /etc/timezone

to check the current time zone, eg:

diff -s /etc/localtime /usr/share/zoneinfo/cat /etc/timezone

Files /etc/localtime and /usr/share/zoneinfo/Australia/Brisbane are identical

More reading at: http://wiki.debian.org/TimeZoneChanges