WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: (SOLVED) Time Zones  (Read 5546 times)

Offline nickjf20

  • Newbie
  • *
  • Posts: 25
(SOLVED) Time Zones
« on: June 05, 2011, 12:52:00 PM »
Hi,

I'm trying to get timezones to work, but they seem to do the opposite of what I add to the bootcodes.

This is my bootcode;

tz=UTC+5DST,M3.3.0/2.M11M1M0/2

and my 'hwclock' (in UTC)

'12:30 ...'

and 'date'

'... 7:30 ... '

DST works fine for UTC+0, but seems to have no effect on any variation.

Thanks.
« Last Edit: June 05, 2011, 05:30:32 PM by nickjf20 »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Time Zones
« Reply #1 on: June 05, 2011, 01:14:20 PM »
Bcause UTC is the timezone, not the reference.
For example: I am in Central Standard Time (US) which is 6 hours behind UTC, so my timzone would be
CST6CDT

Offline nickjf20

  • Newbie
  • *
  • Posts: 25
Re: Time Zones
« Reply #2 on: June 05, 2011, 04:45:29 PM »
Ahh, so the reference is the three letters which denote the timezone rather than the difference between the local time and GMT?

Thats interesting. Is there a list of the timezone denotations around ? I need to work them into this script

 
Code: [Select]
#!/bin/sh

#Written by Nickjf20 for [remaster]+ (C) 2011


ESC_SEQ="\x1b["
RESET=$ESC_SEQ"39;49;00m"
RED=$ESC_SEQ"31;01m"
GREEN=$ESC_SEQ"32;01m"
YELLOW=$ESC_SEQ"33;01m"
BLUE=$ESC_SEQ"34;01m"
MAGENTA=$ESC_SEQ"35;01m"
CYAN=$ESC_SEQ"36;01m"

if [ "$(id -u)" == "0" ]; then
    echo -e "Please do not use sudo."
    exit 1
fi

clear

echo -e "\n\nLocating [remaster]+ grub directory..."
GRUB_DIR=`find /mnt -maxdepth 3 -type d -name grub`

if [ -z "$GRUB_DIR" ]; then
    echo -e "Grub directory not found. Is [remaster]+ installed?"
    exit 1
else
    echo -e "Grub Directory: $GRUB_DIR"
fi

echo -e "\n\nLocating time.sh config"
time_check=`find /home -maxdepth 3 -type f -name time.config`

if [ -z "$time_check" ]; then
    echo "run once" >> time.config
    echo "/usr/local/etc/chrony" >> /opt/.filetool.lst
else
    echo -e "time.config present"
fi

re_run=`cat time.config`

if [ "$re_run" == "run once = true" ]; then
    echo -e "${RED}We notice you have run this script before${RESET}"
    echo -e "${BLUE}Are you sure you want to change settings?${RESET}"
   
    echo -e "\n${BLUE}Press any key to continue...${RESET}"
    echo -e "${RED}Press ctrl+c to quit setup${RESET}"
    read -p ""
fi

tce-load -w -i chrony.tcz

clear

if [ "$re_run" == "run once" ]; then       
    echo -e "${YELLOW}Internet Updating${RESET}\n"
    echo -e "${BLUE}Your [remaster]+ installation will connect to the internet"
    echo -e "every boot to obtain the correct time${RESET}\n"

    echo -e "${BLUE}This is broken into two steps:${RESET}"
    echo -e "${MAGENTA}1) ${RESET}${GREEN}Selecting TimeZone${RESET}"
    echo -e "${MAGENTA}2) ${RESET}${GREEN}Opting to use DST ${RED}(reccomended)${RESET}"

    echo -e "\n${BLUE}Press any key to continue...${RESET}"
    echo -e "${RED}Press ctrl+c to quit setup${RESET}"
    read -p ""

    clear
fi


echo -e "${YELLOW}Internet Clock${RESET}\n"
echo -e "${BLUE}To complete the installation and to recieve internet time in [remaster]+,"
echo -e "you must choose your ${GREEN}time zone.${RESET}\n"
echo -e "\n${MAGENTA}1) ${RESET}${BLUE}Are you in ${RED}UTC / GMT ${BLUE}time? [y]/n${RESET}"
read GMT

if [ -z "$GMT" ]; then
    GMT="y"
fi
if [ "$GMT" == "y" ]; then
    echo -e "\n${BLUE}You have set your ${GREEN}timezone!${RESET}"
    time_zone=+0
fi

if [ "$GMT" == "n" ]; then
    echo -e "\n${BLUE}Please select your${RESET} ${GREEN}timezone.${RESET}"

    echo -e "${YELLOW}i.e. '+4' or '-6' e.t.c...${RESET}"
    read time_zone
   
    echo -e "\n${BLUE}You have set your ${GREEN}timezone ${BLUE}to${RESET}"
    echo -e "${RED}GMT${time_zone}${RESET}"
fi

clear

echo -e "${YELLOW}Daylight Savings${RESET}\n"
echo -e "${BLUE}To complete the installation and to recieve internet time in [remaster]+,"
echo -e "you must decide whether you want${RESET}"

echo -e "\n${MAGENTA}2) ${RESET}${RED}Automatic ${YELLOW}Daylight Savings!${BLUE} [y]/n${RESET}"
echo -e "\n${BLUE}[remaster]+ DST will kick in on the second of March and will last till the first of November${RESET}"
read DST

if [ -z "$DST" ]; then
    DST="y"
fi

if [ "$DST" == "y" ]; then
    echo -e "\n${BLUE}You have turned${RESET} ${GREEN}DST${RESET}"
    echo -e "${RED}ON${RESET}\n"
    DST_STATE=ON
    sed -i "s|kernel /boot/bzImage text quiet.*|kernel /boot/bzImage text quiet tz=UTC${time_zone}DST,M3.2.0/2,M11.1.0/2|" ${GRUB_DIR}/menu.lst
    sed -i "s|run once.*|run once = true|" time.config
    wait 2
fi

if [ "$DST" == "n" ]; then
    echo -e "\n${BLUE}You have turned${RESET} ${GREEN}DST${RESET}"
    echo -e "${RED}OFF${RESET}"
    DST_STATE=OFF
    sed -i "s|kernel /boot/bzImage text quiet.*|kernel /boot/bzImage text quiet tz=UTC${time_zone}|" ${GRUB_DIR}/menu.lst
    sed -i "s|run once.*|run once = true|" time.config
    wait 2
fi

clear

echo -e "${CYAN}Setup Complete${RESET}\n"

echo -e "${BLUE}GMT${RED}${time_zone}${RESET}"
echo -e "${BLUE}DST ${RED}${DST_STATE}${RESET}\n"

echo -e "${GREEN}Please run sudo ./90_reboot_sudo.sh to finalize the installation.${RESET}\n"

echo -e "${BLUE}Changes will ${RED}not ${BLUE}be instant on startup as${RESET}"
echo -e "${BLUE}it takes several seconds to download time data${RESET}\n"
exit





Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Time Zones
« Reply #3 on: June 05, 2011, 05:20:39 PM »
Several references to additional information in this thread
 http://forum.tinycorelinux.net/index.php?topic=5017.msg27012#msg27012
10+ Years Contributing to Linux Open Source Projects.

Offline nickjf20

  • Newbie
  • *
  • Posts: 25
Re: (SOLVED) Time Zones
« Reply #4 on: June 05, 2011, 05:32:05 PM »
Brilliant. Thanks for the link !

I don't know what the general consensus around here is for solved threads, so I'll just add (solved) to the title.

Thanks,

Nick