From 8c8773f3d6449e110936d14c544ec22e97906ef7 Mon Sep 17 00:00:00 2001 From: roleo Date: Mon, 15 Jan 2024 21:09:15 +0100 Subject: [PATCH] Force the cam to work in local time --- src/static/static/home/yi-hack/bin/cloudAPI_fake | 2 +- src/www/httpd/cgi-bin/eventsdir.sh | 7 ++----- src/www/httpd/cgi-bin/eventsfile.sh | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/static/static/home/yi-hack/bin/cloudAPI_fake b/src/static/static/home/yi-hack/bin/cloudAPI_fake index 601d67c..8901b04 100755 --- a/src/static/static/home/yi-hack/bin/cloudAPI_fake +++ b/src/static/static/home/yi-hack/bin/cloudAPI_fake @@ -86,7 +86,7 @@ elif [ "$c" = "142" ]; then #CMD_do_get_dev_info TIMEZONE=$(get_config TIMEZONE) TZP=$(TZ="$TIMEZONE" date +%z) - TZP_SET=$(echo ${TZP:1:2} ${TZP:3:2} | awk '{ print ($1*3600+$2*60) }') + TZP_SET=$(echo ${TZP:0:1} ${TZP:1:2} ${TZP:3:2} | awk '{ print ($1$2*3600+$3*60) }') TZP_GMT=$(echo GMT${TZP:0:1}${TZP:1:2}:${TZP:3:2}) #echo '{"code":"20000","data":{"timezone":"'$TZP_GMT'","language":"en-US","tz_offset":'$TZP_SET'000,"css_flag":0,"css_mode":0,"appParam":"","doorbellCoolingDuration":"0"}}' echo '{"code":"20000","data":{"timezone":"'$TZP_GMT'","language":"en-US","tz_offset":'$TZP_SET'000,"css_flag":0,"css_mode":0,"appParam":"","doorbellCoolingDuration":"0","allowFeature":{"Vehicle":0,"Animal":0,"Person":1}}}' diff --git a/src/www/httpd/cgi-bin/eventsdir.sh b/src/www/httpd/cgi-bin/eventsdir.sh index c7cb8c7..e8ce66c 100755 --- a/src/www/httpd/cgi-bin/eventsdir.sh +++ b/src/www/httpd/cgi-bin/eventsdir.sh @@ -12,11 +12,8 @@ IDX=1 for f in `ls -r /tmp/sd/record | grep H`; do if [ ${#f} == 14 ]; then FS00="${f:0:4}-${f:5:2}-${f:8:2} ${f:11:2}:00" -# if [ "$HV" == "12" ]; then -# FS00E=$(date -d "$FS00" +"%s") -# else - FS00E=$(date -u -d "$FS00" +"%s") -# fi +# FS00E=$(date -u -d "$FS00" +"%s") + FS00E=$(date -d "$FS00" +"%s") FL=$(date +%YY%mM%dD%HH -d "@$FS00E") printf "{\n" printf "\"%s\":\"%s\",\n" "datetime" "Date: ${FL:0:4}-${FL:5:2}-${FL:8:2} Time: ${FL:11:2}:00" diff --git a/src/www/httpd/cgi-bin/eventsfile.sh b/src/www/httpd/cgi-bin/eventsfile.sh index a9214d5..5c1e36f 100755 --- a/src/www/httpd/cgi-bin/eventsfile.sh +++ b/src/www/httpd/cgi-bin/eventsfile.sh @@ -59,11 +59,8 @@ if [ "$DIR" == "none" ] ; then fi DIRS00="${DIR:0:4}-${DIR:5:2}-${DIR:8:2} ${DIR:11:2}:00" -#if [ "$HV" == "12" ]; then -# DIRS00E=$(date -d "$DIRS00" +"%s") -#else - DIRS00E=$(date -u -d "$DIRS00" +"%s") -#fi +#DIRS00E=$(date -u -d "$DIRS00" +"%s") +DIRS00E=$(date -d "$DIRS00" +"%s") DIRL=$(date +%YY%mM%dD%HH -d "@$DIRS00E") printf "Content-type: application/json\r\n\r\n"