jshridha / docker-blueiris

Blueiris in a docker using wine!
Apache License 2.0
106 stars 52 forks source link

TimeZone Issue? #17

Closed ahabers closed 3 years ago

ahabers commented 4 years ago

TimeZone is defaulting to UTC in BlueIris. Set timezone in Docker image to proper timezone, date command shows proper time. Set environment 'TZ=America/New_York'. Still no luck. Anyone else seeing similar behavior, or am I doing something wrong?

jshridha commented 4 years ago

Check out the last couple posts in #6. I'll update readme with documentation of this.

ahabers commented 4 years ago

I've tried linking to localtime via -v /etc/localtime:/etc/localtime:ro, but the date within BlueIris is still incorrect (UTC). Time on the local server that runs this container is set properly. Time inside the container is also set properly when I run a date command.

Server is running CentOS 8.0.1905

Both date commands from server and within container are showing proper time with EST 2020

jcollie commented 4 years ago

I found that /etc/localtime in the container is a symlink to /usr/share/zoneinfo/Etc/UTC. Because it's a symlink docker won't replace it when starting up with -v /etc/localtime:/etc/localtime:ro but actually follows the symlink and puts the file in /usr/share/zoneinfo/Etc//localtime. I had to build a new container with that file removed to get the timezone to work.

Viksie commented 4 years ago

Can anyone provide any clarity on this issue ?

I've removed the symlink /etc/localtime. Passed -v /etc/localtime:/etc/localtime:ro in the compose file. Added and removed locales. Updated all components. Now even rebuild the container.

The container's local time is reflecting the timezone correctly, yet BlueIris v5 simply remains fixated on UTC+0, be it in the overlay, UI3 or VNC session.

leonowski commented 3 years ago

It looks like the fix for this is in wine. Found this: https://forum.winehq.org/viewtopic.php?t=31057

Just tested it and it seems to work. What to do:

wine reg add 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation' /v TimeZoneKeyName /t REG_SZ /d 'Coordinated Universal Time' /f

So, you can bring up bash in docker for the container using:

docker exec -it <container_name> /bin/bash and then run the wine command

OR all at once (hopefully the slashes don't screw things up):

docker exec -it <container_name> wine reg add 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation' /v TimeZoneKeyName /t REG_SZ /d 'Coordinated Universal Time' /f

Then, just restart your container. I'll get this in the blueiris run script soon.

Oh, and you should set the TZ env var for your container.

leonowski commented 3 years ago

Hmm - or maybe not. It fixed the time that the windows environment was on, but blueiris's overlay is still wrong.

Wine does properly fill the windows registry with the correct timezone from TZ on the host. Blueiris just seems to ignore it. 'll keep poking around.

TonyBrobston commented 3 years ago

@leonowski The solution for me was sudo dpkg-reconfigure tzdata to set the correct timezone on the host machine and then this volume mount - /etc/localtime:/etc/localtime:ro. Then a docker-compose down && docker-compose rm && docker-compose up -d.

Viksie commented 3 years ago

With the current jshridha/blueiris image, BlueIris is still fixated on UTC+0 regardless if one tries the above-mentioned mount - /etc/localtime:/etc/localtime:ro or/and dpkg-reconfigure tzdata command.

With the leonowski/docker-blueiris:run_as_service image and TZ=Australia/Sydney specified, the cameras' overlays display the localtime correct, yet the Playback Timeline is still fixated on UTC+0. Triggered clips also display the recorded time as UTC+0.

jshridha commented 3 years ago

Timezone issues are now fixed in the dev branch and further fixed in the feat/vaapi branch. I'm closing this issue for now, but feel free to reopen if you need more help.

Viksie commented 2 years ago

My overlays are correct, except for the "Timeline" within the app that is still reflecting incorrect.