blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.38k stars 1.68k forks source link

[Support]: Recording / playback offset in half-hour time zones #5111

Closed rmounce closed 1 year ago

rmounce commented 1 year ago

Describe the problem you are having

I'm in South Australia. We think like to think that we're special here, so we have a special time zone. Currently UTC+10:30.

With Frigate 0.11 & earlier I had /etc/localtime bind mounted into Frigate. Recordings were saved to disk in a directory structure using local timestamps & all was well (except for possibly overwriting an hour of recordings when DST ends).

With Frigate 0.12 I noticed that a switch to UTC timestamps was made internally, but segments were saved as 30-59 before wrapping around to 00-29 in the same directory. Removing the /etc/localtime bind mount addressed this.

Still, when viewing clips "based on the browser's timezone Australia/Adelaide" there is an offset of 30 minutes. When clicking on an event at 18:06 (correct timestamp), the player loads & seeks to 6 minutes but this actually corresponds to 18:36. To view the event from 18:06, I have to load the previous hour & seek to 36 minutes.

I had a lazy solution in mind to add/subtract the minute part of the offset in the frontend. I got as far as determining the offset in JavaScript before my head started hurting too much & concluded that this a questionable approach.

# returns 30 in Australia/Adelaide
# should return 15 in Asia/Kathmandu (UTC+5:45)
((new Date().getTimezoneOffset() % 60 % 60) + 60) % 60;
# or
# returns 30 in Australia/Adelaide
# should return 45 in Asia/Kathmandu (UTC+5:45)
((-new Date().getTimezoneOffset() % 60 % 60) + 60) % 60;

Version

0.12.0-CF2466C

Frigate config file

# No time zone relevant config in config.yml

Relevant log output

# No relevant logs?

FFprobe output from your camera

# Not a camera specific problem

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

PCIe

Network connection

Wired

Camera make and model

Not a camera specific problem

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

Thanks for the detailed report, I know what the problem is here.