Skip to content

Commit

Permalink
Fix #107
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Jul 30, 2024
1 parent 5458f91 commit d676f84
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/www/httpd/cgi-bin/set_configs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ EOF
fi
let COUNTER=COUNTER+1
done

# Add timezone to config_timezone.ini file
CONFIG_TIMEZONE=/mnt/mtd/ipc/cfg/config_timezone.ini
if [ -f /dayun/mtd/db/conf/config_timezone.ini ]; then
CONFIG_TIMEZONE=/dayun/mtd/db/conf/config_timezone.ini
fi

TZP=$(sqlite3 /mnt/mtd/db/ipcsys.db "select c_zonetime_value from t_zonetime_info where c_zonetime_name='$TIMEZONE';" | sed 's/GMT//g' | sed 's/://g')
TZP_SET=$(echo ${TZP:0:1} ${TZP:1:2} ${TZP:3:2} | awk '{ print ($1$2*3600+$3*60) }' | sed 's/^+//g')
TZP_CUR=$(cat $CONFIG_TIMEZONE | grep offset_second= | sed 's/offset_second=//g' | sed 's/\"//g')
if [ "$TZP_SET" != "$TZP_CUR" ]; then
sed "s/offset_second=\"$TZP_CUR\"/offset_second=\"$TZP_SET\"/g" -i $CONFIG_TIMEZONE
fi

fi

# Yeah, it's pretty ugly.
Expand Down

0 comments on commit d676f84

Please sign in to comment.