I'm running FHEM on my Synology NAS and everything is pretty much great except I cannot change my time zone to anything other than UTC.
Actually, that's not strictly true. I can set the time zone as an environment variable and Perl seems to know it is set i.e. if I enter { $ENV{TZ} } into FHEM it returns Europe/London or BST depending on what I set. However, the FHEM logs and event manager reports times as UTC. Is this normal and if not, how do I change the timezone?
What does { localtime() }
say? (in command field of FHEM)
Currently I have TZ set and if i type "{$ENV{TZ}}" into FHEM it returns "EUROPE/LONDON".
Running the command "{ localtime() }" at 8am returns "Mon Sep 30 06:59:57 2019" i.e. 1hour out.
What does return
{qx(date)}
inside the command line of FHEM?
It returns "Mon Sep 30 08:32:32 EUROPE 2019" at 9:33am
Its seems that the Timezone ist right?
May be DST ist wrong or the system time is wrong.
What returns this?
{qx(date +"%Z %z")}
or better
{qx(timedatectl)}
You are using ntp for time synchronisation?
All points inside the time configuration are right? I found this:
https://www.synology.com/en-global/knowledgebase/SRM/help/SRM/RouterApp/admin_time_region
It's important that not only the time shown at the surface ist right, also timezone and DST should be configured in the right way. There are many points for mistakes :)
the command {qx(date +"%Z %z")} returns "EUROPE +0000".
The command {qx(timedatectl)} does not seem to return anything probably because Synology do not have a timedateclt executable.
The system date/time is set via NTP and at both the Linux level and within the Synology GUI reports the correct time.
EUROPE ???
Europe has 4 timezones at minimum. I know only Timezone Names like Europe/London Europe/Berlin Europe/Moscow etc.
I think Daylight Saving Time is wrong +0000. No country in Europe has no DST at this moment ;)
Whats's your right Timezone?
May be your system is misconfigured. You see the right time but the system is living far from you. ;)
Sorry I can't help you configure the synology, I found only the link in my older post.
I'm in the UK i.e. "Europe/London" or BST timezone.
The Synology itself seems correctly configured and behaves as I expect.
Anyway for some reason I can now change the perl time zone. Maybe because I installed the perl package DateTime::TimeZone but I was trying a number of things as well.
So now if I run "export TZ=GMT-1" prior to starting FHEM I get the correct time in my logs. I know this in not the right TZ but for now it works and I am happy to leave it at for now.
Thanks for your help!
I do not feel good about it. Keep in mind that your system seems to be twice bent.
You will be have similar effects every time if you use software wich depends on time and timezones like calendar and so on.
If you have time, may be you could do some investigation about configure the time in your system.
But I remind me, that synology is a little bit tricky. That is like system on a system - but may be I am not right.
I looked at this again after sleeping on it.
For some reason the Synology sets /etc/localtime incorrectly to be "GMT0IST,M3.5.0/1,M10.5.0" i.e. India Standard Time when Europe/London is selected in the GUI.
The Synology apps obviously ignore /etc/localtime and use their own settings as they show the correct time.
So to get FHEM to work correctly I had to specify the TZ in full i.e. "export TZ=GMT0BST,M3.5.0/1,M10.5.0".
Again thanks for the help