BUG: Timezone for Time Conditions

Looking in the logs I see that for at least the last couple days it’s been using UTC. The first log entry is:

[2016-01-04 03:29:01] Asterisk 13.6.0 built by mockbuild @ jenkins2.schmoozecom.net on a i686 running Linux on 2015-11-24 14:38:56 UTC

I cant say if this actually fixed anything or if it was a coincidence but I did a

hwclock -w

to sync the hardware clock to the “system time” and then everything started working like it should again.

Asterisk aside. You can set the PHP timezone in php.ini. Thats what system admin is supposed to do. From all of our testing it does do that. Try setting the timezone to something else and then back back and see if it fixes it. If it doesn’t then I will guide you on how to set this manually.

I can confirm that it is possible to correct the time shown under Time Conditions by setting the timezone in System Admin and doing a reboot.

However, I am not clear on what we are trying to accomplish here. I already identified a workaround (setting the timezone under Time Conditions) in my first post.

And, regardless of if I can set the timezone under System Admin, it is not working properly right after completing the installation. Furthermore, some folks above are reporting that the system might eventually reset itself to the wrong timezone again.

So, setting the timezone under Time Conditions is the best workaround until the actual bug is being resolved.

To be very honest with you. You are calling this a bug but there are no bug reports about it. From our standpoint there is nothing to resolve???

I would like to say though that while preparing for this last deployment, I probably ran the install at least a dozen times (just playing with different features, configurations, etc) and every install had the same problem. Although I selected the Time Zone during install, System Admin reflected the correct name of my Time Zone, and running “date” from the CLI reflected the correct local time, the Time Conditions module reflected UTC time after every install. Every install required some effort to have FreePBX report the correct local time.

So, I personally was unable to narrow down where the problem was being generated, thus unable to provide any valuable troubleshooting information. But, it happened on every single install I ran. Interestingly, I had another problem which is probably not related, but could possibly. After a fresh install, the Rest Phone Apps wouldn’t work. I double-checked the firewall settings, confirmed the port numbers, but they simply wouldn’t work. To fix it, I had to go to System Admin ----> Port Management, and without changing a single setting, I had to press ‘Update Now’ on that page. After doing that, the Rest Phone Apps worked fine. So, although it may not be related, it does seem that System Admin is not applying some settings correctly and is requiring some user intervention before the settings are applied.

I hope that helps…

In the newest sysadmin, time conditions and hotel wakeup calls it displays the active server time with the timezone. If someone runs into the issue again please let us know as running “date” on the CLI doesn’t make a difference to PHP, that only applies to Asterisk and Apache. EG you can run date all day long but PHP could be something totally different

Also if anyone has set this in System Admin and it was still showing the wrong time in the GUI please search php.ini for “Automatically updated by Sysadmin” and let us know if you find that. If you do post the text surrounding it so we can make sure it actually worked

Since the issues can be reproduced, I am guessing that there is a bug in the installation script. I am also guessing that the timezone reset issue is caused by the same script if it is being reused during system upgrades.

To be fair, I do see a lot of complexity since PHP comes to the mix…

I am sorry that I cannot provide more help on resolving this bug, but my technical knowledge on Linux and PHP is somewhat limited.

From my perspective, it might help to locate the issue in the installation script. I mean the issue can currently be resolved by re-applying the timezone in System Admin. So, I am guessing that the “script” used there is different from the installation script.

Hope that helps…

I also checked the php.ini file before posting and it showed the correct time zone on mine but the system was still using UTC.

date.timezone = “America/Los_Angeles” ;;;; Automatically updated by Sysadmin

Timezone information is only set in system admin so no. There is nothing in any installation script(s).

@bksales that is all we can do. The functionality is working correctly. I see no bugs with that. I am only going to change the way Apache restarts.

I just confirmed on a standalone system that the timezone is changing and being set correctly.

Not sure what you mean by its working correctly. There are multiple people in this thread saying that changing it in the GUI does not fix it and I can confirm that while it was not working correctly the php.ini file did in fact show the correct time zone (as did the GUI and the date command).

I say “working correctly” because the only way to define the timezone is by putting it into that php.ini file and then restarting apache. The code is working as expected and when I test it myself I can’t replicate your issues. Thats what I mean when I say that.

Furthermore looking at the code base the timezone is not set automatically during or after an installation. It has to be set through the GUI at least once. (by set I mean saved etc)

sysadmin version 13.0.33 restarts apache differently than before during a timezone change. However. Because it’s a “hook” process it doesn’t run in line with the GUI. Therefore when you save in the GUI the first time and the page comes back it might still be wrong until a page refresh. You can also hit submit again which won’t hurt anything.

When installing the FreePBX Distro, there is a step in the OS questions at the beginning that asks for your Time Zone. After the installation is complete, going to System Admin ------> Time Zone, the GUI reflects the choice made during the installation. Perhaps this is why many are considering it a problem. The question is asked and answered, but isn’t actually applied in FreePBX.

No biggie though. Perhaps the updated version won’t do this. But when users see the correct time zone in the GUI, but have the wrong time in Time Conditions, the problem will be brought up again… and again… and again…

You’ve nailed the issue. I’m looking into this right now, really just waiting for @xrobau to wake up in Australia so I can ask.

I agree. I want this fixed. It should be fixed to line up. It’s confusing otherwise.

1 Like

The latest installation is asking for the timezone during the setup process. It also carries over to System Admin, but not to Time Conditions.

Good to see that we are all on the same page now! :smile:

Yes it carried over to System Admin but it was not applied until you click save in the timezone screen. This was as intended. Not saying it was the right way.

Awesome… thanks for looking in to it.

This is now resolved, it requires a new Core, Sysadmin and Framework. This might also fix people having previous problems but I’m not 100% sure yet on that

1 Like

Now that was fast!! :grinning: