Open TheNinth7 opened 1 year ago
This issue has been mentioned on openHAB Community. There might be relevant details there:
https://community.openhab.org/t/openhab-running-in-docker-system-time-is-one-hour-behind/143637/4
The Docker Container is isolated from the host. In short, it doesn't know what timezone your Syonlogy has. You need to tell the container what timezone to use. Often this is done by simply mounting /etc/timezone
into the container. Or alternatively, you can set the timezone for the JRE using the EXTRA_JAVA_OPTS like you discovered.
This isn't an OH issue, it's a Docker issue. And if you look at https://www.openhab.org/docs/installation/docker.html and https://hub.docker.com/r/openhab/openhab/ you will notice that all the examples mount this file into the container and the first link discusses why.
At a minimum this needs to be moved to the openhab-docker repo but I believe this is already solved.
Understood, but should not the timezone settings in the OH regional settings be applied?
That's used by some bindings but it does not override the OS nor the JRE timezone so those parts of OH which rely on third party stuff like log4j2 and karaf do not know nor would not know anything about the OH setting. And I'm sure if there were a way to have OH update the timezone for the JRE and OS from that setting, it would do so.
Which APIs are the bindings supposed to use to get correct handling here?
(Given that java.util.TimeZone.getDefault()
is not “it”?)
I am running openHAB 3.4.0 in a Docker container on my Synology NAS, a DS420+ with DSM 7.1.1-42962 Update 1.
My timezone is GMT+1 (Vienna).
Time and timezone on the NAS is set correctly. I also set the timezone to GMT+1 Europe/Vienna in openHAB‘s regional settings.
Still, openHAB uses UTC/GMT as timezone. I noticed that on several places, the log file entries, the time returned by time.toZDT() in Javascripts, the last update time of my Shelly H&T sensors and the Karaf console, where “date” shows the UTC time.
When setting the timezone via
EXTRA_JAVA_OPTS="-Duser.timezone=Europe/Vienna"
for the Docker contajner it works and then times in all the above-mentioned places are correct.