Wrong date/timezone shown in admin>server information

Hi,

Today after an update to emonpi just decided to select the correct timezone (Europe/Lisbon) instead of using UTC (just really an hour off in the summer).
Followed the guide [1] and updated it in emonpi (and set it up in emoncms) to GMT+1, all seems to work fine. It’s just under Emoncms > setup > admin - Server Information that it’s showing 1 hour off for Server: 2018-08-12 17:27:23 CEST. In the MySQL Date it is correct: 2018-08-12 16:27:23 (UTC 01:00‌​)

Cheers,
RP

1 - Troubleshooting - Guide | OpenEnergyMonitor

The only issue is that your server timezone is CEST and should be in WEST since you are in Portugal.
But the server location (or timezone) does not matter to emoncms.
If you correctly configured on the emoncms MyAccount Europe/Lisbon, you will not have any problem.

Olá nchaveiro :smile:

As i’ve said in my initial post, I’ve followed the guide and set both emoncms and the system (emonpi) timezones to the correct one: Europe/Lisbon (WEST).

In emoncms, when I check the server info, it shows the CEST timezone. It’s nothing major, was just saying that the timezone is wrongly displayed there.

I’ve attached the images to demo this:
Timezone in emonpi:
emonpitz

timezone in emoncms:
emoncmstz

time displayed in server info panel:
emoncms%20serverinfo

I did a brief check on this and the issue seems to be the default timezone in PHP. The server time shown there is being obtained with date('Y-m-d H:i:s T'), and this seems to use the default timezone set up in PHP configuration.

An additional image to demonstrate this, it gets back to Europe/Paris when existing the php shell:
phptz

So I guess the solution should either be that default timezone in PHP should be set to system timezone in emoncms every time or maybe better, adding to the guide that TZ should also be changed in php.ini?
phptz2

Cheers

1 Like

Per the PHP documentation the default answer of date_default_timezone_get() should be UTC if nothing was set in php.ini. So that is strange indeed.
What is that php version, do you have a /etc/localtime file or a TZ environment variable set?

php 5.6, correct /etc/localtime and no TZ env var as you can see I have all the default configs:

As you said, according to the php documentation it should return UTC, I have no idea why the Europe/Paris.
Just searched for possible files where that could be set but did not find anything.
tz2

Anyway, even if it was returning UTC, the server info would still be wrong, as the correct is WEST / UTC+01 so I just ended up setting the PHP timezone in both cli and apache configs and it now is working correctly. If anyone is interested, the two files that need to be edited to uncomment and change date.timezone = “Europe/Lisbon” are:
tz3

I’ve found out that this is one of the steps in the instructions of the LinuxInstall.md, since I’m using a vanilla emonPI with the latest updates I’ve never followed that.

1 Like