WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to change timezone in core linux?  (Read 6977 times)

Offline Adam

  • Full Member
  • ***
  • Posts: 121
How to change timezone in core linux?
« on: February 22, 2017, 09:12:29 PM »
Hi,

Normally I'll create a link to /etc/localtime in order to change a timezone. Unfortunately, I can't find this in Core Linux. Please advise.

Code: [Select]
tc@box:~$ ls -lh /etc/localtime*
ls: /etc/localtime*: No such file or directory
tc@box:~$

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: How to change timezone in core linux?
« Reply #1 on: February 22, 2017, 09:25:58 PM »
You can use the tz and utc/noutc boot codes and the tzdata extension (see info file).
« Last Edit: February 22, 2017, 09:34:46 PM by Juanito »

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to change timezone in core linux?
« Reply #2 on: February 22, 2017, 09:55:47 PM »
You can use the tz and utc/noutc boot codes and the tzdata extension (see info file).

Thanks Juanito for your feedback. However, I still can't figure out how to change this. I've been searching for a quite some time but still can't find clear documentation on how to change this.

This is the one of them, but it's not so clear.. where to change it, which file, etc.
Quote
How To Set the Timezone?

If you live where in an area that has DST then you need to use the full specific ation for the tz variable. Indicating both the begin and end of DST.

For example mine tz boot code is: tz=PST+8PDT,M3.2.0/2,M11.1.0/2

In the above DST clause PDT,M3.2.0/2,M11.1.0/2

M3 = month nbr (1-12)
2 = week nbr (1-5)
0 = day of week (0-7)
/2 = time

So for PDT it begins March second Sunday at 2AM and end November first Sunday at 2AM.

For more info see this post on the forums.

This is another info that I get during tzdata.tcz installation. I've tried all the possible suggestions, but it didn't work.
Quote
                       
tc@box:~$ tce
tce-ab - Tiny Core Extension: Application Browser

S)earch P)rovides K)eywords or Q)uit:
Enter starting chars of desired extension, e.g. abi: tz
                        tz=Australia/Melbourne
                To change the tz on the fly, just
                        export TZ=America/Chicago
                To search the possible TZ values, use
                        sudo /usr/local/etc/tzselect
                This build has no dependencies. Modifications:
                        sets LOCALTIME=UTC (instead of GMT)
                        sets tzselect to use /bin/sh (instead of /bin/bash)
                        ln -s /usr/share/zoneinfo* /usr/local/etc/zoneinfo*

                If the tz bootcode is used, this extension creates /etc/localtime
                as a link to the corresponding file in /usr/local/share/zoneinfo.

Doesn't work
Code: [Select]
tc@box:~$ date
Thu Feb 23 05:52:30 UTC 2017
tc@box:~$ tz=Australia/Melbourne
tc@box:~$ date
Thu Feb 23 05:52:36 UTC 2017

This is the only one that works fine. However, the time will be change to UTC after I rebooted it. I tried to put it on bootlocal.sh but didn't work too.
Code: [Select]
tc@box:~$ date
Thu Feb 23 05:53:20 UTC 2017
tc@box:~$ export TZ=America/Chicago
tc@box:~$ date
Wed Feb 22 23:53:22 CST 2017
tc@box:~$

Command not found?
Code: [Select]
tc@box:~$ sudo /usr/local/etc/tzselect
sudo: /usr/local/etc/tzselect: command not found
tc@box:~$

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: How to change timezone in core linux?
« Reply #3 on: February 22, 2017, 10:07:28 PM »
You change the tz boot code in your bootloader (grub, syslinux, etc).

If you use the tz boot code, you need to set the tzdata extension to load "onboot" with the apps gui.

If you use the apps gui "provides" function, you'll see that tzselect is provided by the glibc_apps extension.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11213
Re: How to change timezone in core linux?
« Reply #4 on: February 22, 2017, 10:16:51 PM »
Hi Adam
This is the only one that works fine. However, the time will be change to UTC after I rebooted it. I tried to put it on bootlocal.sh but didn't work too.
Code: [Select]
tc@box:~$ date
Thu Feb 23 05:53:20 UTC 2017
tc@box:~$ export TZ=America/Chicago
tc@box:~$ date
Wed Feb 22 23:53:22 CST 2017
tc@box:~$
I think adding your export to  ~/.profile  should work.

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to change timezone in core linux?
« Reply #5 on: February 22, 2017, 11:42:45 PM »
I think adding your export to  ~/.profile  should work.
Yeah, it works!

However, the time on my core is totally wrong now. This is all UTC hours, not Central time
Code: [Select]
tc@box:~$ date; TZ=America/Chicago date; TZ=UCT date
Thu Feb 23 07:49:28 America 2017
Thu Feb 23 07:49:28 America 2017
Thu Feb 23 07:49:28 UCT 2017
tc@box:~$
« Last Edit: February 22, 2017, 11:51:31 PM by Adam »

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to change timezone in core linux?
« Reply #6 on: February 22, 2017, 11:54:12 PM »
You change the tz boot code in your bootloader (grub, syslinux, etc).

If you use the tz boot code, you need to set the tzdata extension to load "onboot" with the apps gui.

If you use the apps gui "provides" function, you'll see that tzselect is provided by the glibc_apps extension.
Thanks Juanito,

Are you referring to this file?
Code: [Select]
/mnt/sda1/boot/grub/menu.lstCan you show how's the code looks like if I want to change the default UTC to other time zone.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: How to change timezone in core linux?
« Reply #7 on: February 23, 2017, 12:26:15 AM »
Code: [Select]
title core
root (hd0,3)
kernel /boot/vmlinuz quiet tz=GMT-4 host=macminitc syslog text
initrd /boot/core.gz

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to change timezone in core linux?
« Reply #8 on: February 23, 2017, 12:54:55 AM »
Code: [Select]
title core
root (hd0,3)
kernel /boot/vmlinuz quiet tz=GMT-4 host=macminitc syslog text
initrd /boot/core.gz

Thanks Juanito. I changed the config as suggested, but when I issue date command, it's actually in UTC time zone, not Central time.
Code: [Select]
tc@box:~$ cat /mnt/sda1/boot/grub/menu.lst
default 0
timeout 0
title core
kernel /boot/vmlinuz quiet tz=America/Chicago
initrd /boot/core.gz
tc@box:~$

This is all UTC time
Code: [Select]
tc@box:~$ date; TZ=America/Chicago date; TZ=UCT date
Thu Feb 23 08:52:34 America 2017
Thu Feb 23 08:52:34 America 2017
Thu Feb 23 08:52:34 UCT 2017
tc@box:~$

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: How to change timezone in core linux?
« Reply #9 on: February 23, 2017, 01:04:45 AM »
Did you reboot after changing menu.lst?

Was tzdata set to load "onboot"?

Is your bios clock set to local time or utc (linux expects it to be set to utc)?