yi-hack-Allwinner-v2 icon indicating copy to clipboard operation
yi-hack-Allwinner-v2 copied to clipboard

Date / Time Problem

Open SmartM-ui opened this issue 4 years ago • 64 comments

Hi, By leaving the timezone setting blank, the date in the event records have the correct date (real time 00.56 - Time reported: 00:56):

Schermata 2021-09-03 alle 01 06 49

but the local time is two hours behind (real time sep 03 01:02:23 - time reported: sep 02 23:02:23

Schermata 2021-09-03 alle 01 02 31

and also in the motion_files (see the end date) it is two hours behind (Real Time: 03.09.2021 00:58:22 - Time Reported: 2021.09.02 22:57:12)

Schermata 2021-09-03 alle 01 04 10

If I set the timezone with the Italian value, the date in the event log is two hours ahead.

How should I set the value for the timezone to have a synchronization of all dates / times?

Thanks

SmartM-ui avatar Sep 02 '21 23:09 SmartM-ui

How did you set timezone in the yi app?

roleoroleo avatar Sep 10 '21 19:09 roleoroleo

How did you set timezone in the yi app?

Hi @roleoroleo

timezone in YIhome: UTC +1:00

SmartM-ui avatar Sep 21 '21 13:09 SmartM-ui

Plase, try to set timezone = GMT in the app. Check this post: https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/203#issuecomment-918762012

roleoroleo avatar Sep 22 '21 07:09 roleoroleo

Plase, try to set timezone = GMT in the app. Check this post: #203 (comment)

Perfect. I didn't set the same value, but I set UTC +0 in the YIHome app and set the correct timezone to YI-HACK. Now the time is correct everywhere

SmartM-ui avatar Sep 22 '21 10:09 SmartM-ui

The name should be "Coordinated universal time".

roleoroleo avatar Sep 22 '21 10:09 roleoroleo

The name should be "Coordinated universal time".

That's right, I set Coordinated universal time! Thanks

SmartM-ui avatar Sep 22 '21 10:09 SmartM-ui

@roleoroleo Am I missing a step? I'm getting confused because it's not working as expected... Yi Home 1080p IFUS 9.0.36.02_202105081647 y211ga

UPDATE: Is this part something on the Yi-Hack side that could be updated, or something with Yi's firmware, which can't be touched? https://forum.filezilla-project.org/viewtopic.php?t=48775 https://forum.filezilla-project.org/viewtopic.php?t=37273#p136743 I see a few threads about servers not handling MDTM correctly.

Even if I disable NTPD, times don't seem to match up, universally. There seem to be different variables. For example, if the time is December 4, 2021 23:05:00 (GMT-6) and I've set the following and then rebooted: Yi-Hack: CST6CDT,M3.2.0,M11.1.0 Yi-Hack NTPD: disabled Yi app: Coordinated universal time

I'm rounding off numbers and keeping them consistent after observing the changes, for simplicity in showing the issue... Bolded are changes. I'm sorry for the wall of text, but I wanted you to see what changes.

My computer shows "December 4, 2021 23:05:00" (correct) Yi-Hack web status shows "Sat Dec 4 23:05:00 CST 2021" (correct) Recording folder being recorded to is "2021Y12M04D23H" (correct) Filezilla client to Yi-Hack FTP recorded file (dynamically changes, not read/write) modified time shows "12/4/2021 17:05:00" (6 hours behind)

Now, if I remove the timezone set in Yi-Hack configuration page, save, power cycle completely (not a soft reboot): My computer shows "December 4, 2021 23:05:00" (correct) Yi-Hack web status shows "Sun Dec 5 05:05:00 GMT 2021" (6 hours ahead) Recording folder being recorded to is "2021Y12M05D05H" (6 hours ahead) Filezilla client to Yi-Hack FTP recorded file (dynamically changes) modified time shows "12/4/2021 23:05:00" (correct)

Now, if I change the Yi app timezone to UTC-06:00, power cycle, nothing seems to change.

Now, if I change the Yi-Hack timezone to CST6CDT,M3.2.0,M11.1.0, save, power cycle: My computer shows "December 4, 2021 23:05:00" (correct) Yi-Hack web status shows "Sat Dec 4 23:05:00 CST 2021" (correct) Recording folder being recorded to is "2021Y12M04D23H" (correct) Filezilla client to Yi-Hack FTP recorded file (dynamically changes) modified time shows "12/4/2021 17:05:00" (6 hours behind)

Now, if I "Disable Cloud", "Enable Recording without Cloud", "Enable NTPD", save, power cycle: My computer shows "December 4, 2021 23:05:00" (correct) Yi-Hack web status shows "Sat Dec 4 23:05:00 CST 2021" (correct) Recording folder being recorded to is "2021Y12M04D23H" (correct) Filezilla client to Yi-Hack FTP recorded file (dynamically changes) modified time shows "12/4/2021 18:05:00" (5 hours behind)

Now, if I change the Yi app timezone to Coordinated universal time, power cycle, nothing changes.

Now, if I re-enable "Cloud" (keeping NTPD enabled), save, power cycle: My computer shows "December 4, 2021 23:05:00" (correct) Yi-Hack web status shows "Sat Dec 4 23:05:00 CST 2021" (correct) Recording folder being recorded to is "2021Y12M04D23H" (correct) Filezilla client to Yi-Hack FTP recorded file (dynamically changes) modified time shows "12/4/2021 18:05:00" (6 hours behind)

Jon8RFC avatar Dec 05 '21 05:12 Jon8RFC

@roleoroleo , I am also having issues with timestamp / time zone on my Yi 1080 Home.

BUT.... the issue only presents itself on the date/timestamp overlay that is overlaid on the rtsp stream.

My setup is:

  • Yi 1080 Home, QFUS

  • Using Yi App: Time zone set to UTC +0000

  • Yi Hack web: set time zone to my correct time zone, disabled cloud, enabled NPT time sync, reboot.

The result:

Yi Hack web reports the local time correctly - 10:14am (I am GMT-4, so GMT would be 2:14pm) However, the timestamp overlay on the rtsp stream shows 8 hours ahead! It's as if it has added 4 hours to GMT, rather than subtracted 4 hours. (it is showing 18:14, as shown below).

I have tried different combinations of Yi time zone, NTP on/off, Yi Hack time zone, and cannot get these to agree.

image

canuckray avatar Jan 20 '22 15:01 canuckray

Your problem is different because is related to the overlay. And I don't know hot to solve it because it depends on the yi firmware.

But check if the "rmm" process has the correct environment variables. Login with ssh. Find the process id: ps | grep rmm Check the environment: cat /proc/<PID>/environ

roleoroleo avatar Jan 20 '22 16:01 roleoroleo

Thanks for the quick reply - appreciate it. The output is below. Looks cryptic to me, but maybe something will jump out at you.

image

canuckray avatar Jan 20 '22 16:01 canuckray

TZ variable is absent. This is not ok. What is yout timezone setting in the web interface?

roleoroleo avatar Jan 20 '22 20:01 roleoroleo

pasted from web interface: EST5EDT,M3.2.0,M11.1.0 (this is the America / Toronto TZ string)

image

canuckray avatar Jan 20 '22 20:01 canuckray

I checked the script and I can't understand. Try another command: cat /proc/PID/environ | tr '\0' '\n'

roleoroleo avatar Jan 21 '22 16:01 roleoroleo

image

canuckray avatar Jan 21 '22 16:01 canuckray

di you fix it? i habe UTC-0 in Yi app. my timestamp up left in the video is incorret.

image

image

image

when i enable cloud feature. the time is correct.

SeriousPat avatar Feb 11 '22 15:02 SeriousPat

I don't know how to fix it, at the moment.

roleoroleo avatar Feb 11 '22 17:02 roleoroleo

FWIW I found using the setting GMT in the Yi app and TZ in Yi-Hack breaks the seek time in the Yi android app when trying to playback video. For those using RTSP and personal recorders I guess it doesn't matter but I ended up changing both yi app and yi hack to the proper timezone and only applying the timezone inline where needed in system.sh. For example with httpd, although others might be added.

export TZ=$(get_config TIMEZONE)
if [[ $(get_config HTTPD) == "yes" ]] ; then
    mkdir -p /tmp/sd/record
    mkdir -p /tmp/sd/yi-hack/www/record
    mount --bind /tmp/sd/record /tmp/sd/yi-hack/www/record
    httpd -p $HTTPD_PORT -h $YI_HACK_PREFIX/www/ -c /tmp/httpd.conf
fi
# maybe some other apps here too
export -n TZ

But what works for me might not work for others and I don't know if Yi use daylight savings, maybe someone with daylight savings can shed some light? :)

Example with above and +7hrs set for both Yi Hack (where needed) and the Yi app. The r30gb needs a workaround but the other camera's b091qp/h60ga seem fine.

5

ghost avatar Feb 16 '22 01:02 ghost

I wanted to try to do the opposite: run rmm without TZ. But probably your solution is better.

roleoroleo avatar Feb 16 '22 10:02 roleoroleo

To be clear rmm doesn't have the 'TZ' variable set and the yi-app time zone doesn't set the TZ variable but applies an offset as was commented here https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/203#issuecomment-920509721

ghost avatar Feb 17 '22 02:02 ghost

@SeriousPat Try this system.sh (overwrite the original one). Set your timezone in the app (instead of UTC) and in the web gui. Reboot and check:

  • Date/time in status web page.
  • The watermark printed on the video and on the snapshot.
  • If you are able to play videos captured with a motion (both web gui and app).

system.tar.gz

roleoroleo avatar Feb 18 '22 07:02 roleoroleo

What about the date/time of the table in the "Events" page. Is it ok? Or is it shifted by an offset? I changed the system.sh and I reconfigured the correct time in the app. Now, the time of the events is not ok.

roleoroleo avatar Feb 24 '22 20:02 roleoroleo

Not sure who you are asking, if it's me then my event page is fine. Don't use MQTT, CRON and SSH seems to do it's own thing with time, as I said before I'm a noob with Linux and not that much better with Windows so don't know.

TBH just telnet/ssh and ftp would be enough for me with these camera's but it's nice to learn so I try a few things. Even learning a little arm and wrote a test grabber with piped aac and video streams from fshare. Audio was a bit hit and miss with my modification to rtsp_server_yi, the newer one you submitted works better than my attempt. Not sure what to do with videofile.cpp to get the 265 working, all those brackets and semi colons do my head in. :/

ghost avatar Feb 25 '22 03:02 ghost

Not sure what to do with videofile.cpp to get the 265 working, all those brackets and semi colons do my head in. :/

Check the last commit: https://github.com/roleoroleo/RtspServer/tree/yi

roleoroleo avatar Feb 25 '22 16:02 roleoroleo

Forgot to mention I'm not using ONVIF either and RTSP is being used for learning purposes, no dedicated box for it's use. Cloud is enabled but no cloud storage.

Check the last commit: https://github.com/roleoroleo/RtspServer/tree/yi

Cool, will try it out later today. Will start another thread under discussions.

ghost avatar Feb 26 '22 00:02 ghost

Thanks for the excellent software. Its magical to be able to ssh and play around into the camera.

Am facing similar date time problems.

I moved the export TZ to just before the rmm is executed, this seems to fix the folder label. However the overlay on top left is still 8 hours behind.

FYI: I am not using Yi App at all and all cloud features are disabled. Is there anyway to modify the firmware timezone offset? I am looking through #203 . Any tips?

kalyan02 avatar Jul 09 '22 11:07 kalyan02

I don't know how to set the internal timezone (I mean the same that the app changes) without using the app. You should configre the app just for the time to set the cam.

roleoroleo avatar Jul 09 '22 16:07 roleoroleo

I'm having the same issue. The timestamp on the rtsp feed is off by 5hrs, whenever I disable cloud. I have the yi app set to UTC. If I set the timezone to EST (which should subtract 5 hrs from UTC), it adds 5 hours more to the timestamp, so it shows a time that is 10hrs ahead. I tried multiple combinations of turning off ntdp, timezones, reboot cycles, but the timestamp seems to be always off unless I don't disable cloud.

rikrdo89 avatar Nov 24 '22 16:11 rikrdo89

Is your TZ positive or negative?

roleoroleo avatar Nov 25 '22 14:11 roleoroleo

It's supposed to be negative... my TZ is EST5 (Eastern time, which UTC - 5 hr)

rikrdo89 avatar Nov 25 '22 14:11 rikrdo89

Try to overwrite 2 files contained inside this archive: patch.tar.gz

/tmp/sd/yi-hack/bin/set_tz_offset /tmp/sd/yi-hack/script/system.sh

roleoroleo avatar Nov 25 '22 14:11 roleoroleo