Commit aff2860ce02c227a66ab442250f2429726a80380

  • avatar
  • Sergey 'Jin' Bostandzhyan <jin @d…v.digitalstrom.org>
  • Sun Aug 29 00:47:44 CEST 2010
Fixed BST handling

Turned out that BST was a somewhat special case, there is no
/usr/share/zoneinfo/BST file to link to; when
/usr/share/zoneinfo/Europe/London is selected then date command can show
BST

So we're handling this special case now, by assuming that
BST is the same as Europe/London
www/cgi-bin/dateinfo.sh
(3 / 0)
  
8282 TIME=`date +%T`
8383 UTC=`date -u +%s`
8484 ZONE=`date +%Z`
85 if [[ "$ZONE" == "BST" ]]; then
86 ZONE="Europe/London"
87 fi
8588
8689 echo -n "\"date\": \"$DATE\", \"time\": \"$TIME\", \"utcsecs\": $UTC, \"zoneshort\": \"$ZONE\", "
8790 return $ERR_OK
www/cgi-bin/setdate.sh
(7 / 2)
  
7777 return $ERR_OK
7878 fi
7979
80 if [[ ! -f "$ZONEINFO$1" ]]; then
80 WANTED_TZ="$1"
81 if [[ "$WANTED_TZ" == "BST" ]]; then
82 WANTED_TZ="Europe/London"
83 fi
84
85 if [[ ! -f "$ZONEINFO$WANTED_TZ" ]]; then
8186 json_error $ERR_NOZONES "Requested time zone is not installed!"
8287 return $ERR_NOZONES
8388 fi
8489
8590 rm -f /etc/localtime 1>&2
86 ln -s "$ZONEINFO$1" /etc/localtime 1>&2
91 ln -s "$ZONEINFO$WANTED_TZ" /etc/localtime 1>&2
8792 if [[ "$?" -ne "0" ]]; then
8893 json_error $ERR_LINK "Could not set requested zone, link failed!"
8994 return $ERR_LINK