Page 1 of 1

timezone settings

Posted: Mon Apr 04, 2022 4:52 am
by Tantamount
Not sure what I broke -- recent recordings in the events folder are showing what I think is UTC dates, while zm expects to find the recordings using the timezone I've got configured.

Error:

Code: Select all

Event was not found at /var/cache/zoneminder/events/5/2022-04-03/101303. It is unlikely that playback will be possible.
Reason:
Local end time of event shows in the zm gui as 04/03/22 20:08:53, however in UTC, it would be one day ahead

Code: Select all

root@server-0:/var/cache/zoneminder/events/5/2022-04-04# ls -la 101303
total 19246
drwxr-xr-x  2 www-data www-data        3 Apr  4 03:09 .
drwxr-xr-x 56 www-data www-data       54 Apr  4 04:43 ..
-rw-rw-r--  1 www-data www-data 17055132 Apr  4 03:09 101303-video.mp4
I /think/ I've got the timezone settings correctly synced everywhere, and haven't made any changes to ZM, so I'm a bit perplexed why this would happen all of a sudden? Still running v1.36.12

mariadb docker container uses TZ environment variable:

Code: Select all

TZ=America/Los_Angeles
If I use the mysql client and 'select now()' it shows the time and date for that timezone.

and in the ZM database a query for the timezone settings correctly returns the same zone:
select Value from Config where Name= "ZM_TIMEZONE";

Code: Select all

+---------------------+
| Value               |
+---------------------+
| America/Los_Angeles |
+---------------------+

php.ini contents:

Code: Select all

[Date]
date.timezone = America/Los_Angeles
The events show the correct timezone in the gui, so ZM seems to know what's up, but oddly doesn't when it chooses to create the date folders?

Re: timezone settings

Posted: Mon Apr 04, 2022 8:42 am
by dougmccrary
You wouldn't have run windows on that, would you?
Otherwise, what's in options -> timezone? Probably LA, but...

Re: timezone settings

Posted: Wed Apr 06, 2022 5:28 am
by Tantamount
dougmccrary wrote: Mon Apr 04, 2022 8:42 am You wouldn't have run windows on that, would you?
Otherwise, what's in options -> timezone? Probably LA, but...
Screen Shot 2022-04-05 at 10.25.21 PM.png
Screen Shot 2022-04-05 at 10.25.21 PM.png (31.31 KiB) Viewed 1163 times
That should be the same value I mentioned above when I ran this on the sql server:

Code: Select all

select Value from Config where Name= "ZM_TIMEZONE";
Microsoft Windows is not in the picture at all. All of this runs in containers on linux nodes.

Re: timezone settings

Posted: Wed Apr 06, 2022 7:18 am
by Magic919
I expect nobody else is running ZM in K8S.

Re: timezone settings

Posted: Wed Apr 06, 2022 1:25 pm
by iconnor
Having a little trouble wrapping the problem in my head, but here's some thoughts:

The actual recording and timestamping are done in C++ land, using system time. So nothing to do with php. So the question is what is the system timezone set to? Sounds like it might be UTC, which is likely the default in a container... distros ask this when installing, but when auto spinning up a container.. they have to guess. So the thing to do would be to look at what the data command says from a command line in the container... and I don't know what's available for setting it. On a full system running systemd it would be sudo timedatectl set-timezone America/Los_Angeles

The php setting is to tell php what timezone you are in for constructing sql queries etc so that they match.
They all have to be in sync.