Timezone Changes

I am going to post this little tip here because I know next time I need to fix Time Conditions… this is probably one of the places I will look.

Problem: Your dumb @$$ hosting provider decides, without your permission or notification, to go around and “fix” all the hardware clocks on all the DEDICATED SERVERS so the clock is “correct”.

The problem is your PBX serves customers in places where the clock only changes by 30 minutes or doesn’t change at all.

So you come in the morning after thinking “I did not update my servers so everything should be fine” morning and your “customers” (internal staff) are all angry because their Time Conditions have decided to tell customers your office is closed for as much as a full hour after everyone has shown up for work costing you thousands of dollars in revenue.

1 - ln -sf /usr/share/zoneinfo/Country/City /etc/localtime
2 - /sbin/hwclock --systohc
3 - /etc/init.d/asterisk restart (important - seems that asterisk doesn’t notice the time change unless you restart the service)
4 - tail /var/log/asterisk/full <-- confirm the clock is right in the logs

I hope this helps the next guy who is ripping out his hair because 1) his logs are all off by some number of hours 2) all his time conditions are wrong 3) voicemails are wrong

Correct time is essential for any network connected computer that is why the NTP protocol exists, Hardware clocks should ALWAYS be on standard time (unless you are using Windoze :slight_smile: ) so the skew is never far from NTP, a booted OS is ALWAYS responsible for providing local time including locale specific daylight savings time. There are many mechanisms in Linux to ensure that is true, check your TZ settings/data are correct and updated, including php.ini . Always use NTP for time and only use your local clock if no higher stratum is available, if their is no higher level, then pretty well guaranteed that yor SIP/IAX2 trunks are not working either.

If you follo those basic guidelines, I don’t think that you would have the problems as you describe.