Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: kagashe on January 07, 2009, 07:34:53 PM

Title: [SOLVED] How to change timezone?
Post by: kagashe on January 07, 2009, 07:34:53 PM
The time indicated by the clock is UTC.

I would like to change it to my timezone Kolkata (UTC+5:30). I looked at /usr/share/zoneinfo/Asia in which my city is not listed. I also find that /etc/localtime is not a symlink.

How to set it?

kagashe
Title: Re: How to change timezone?
Post by: Juanito on January 07, 2009, 07:45:22 PM
What you can do is get hold of the latest timezone data tarball, extract the timezone you need and then make an extension of it/add it to your backup.

Once that is done, you can manually run the timezone update script from a terminal window or make your own script.

The timezone data extract is explained in linux-from-scratch or, if needed, I can dig out what I did in dsl to achieve the same thing
Title: Re: How to change timezone?
Post by: kagashe on January 08, 2009, 03:30:20 AM
What you can do is get hold of the latest timezone data tarball, extract the timezone you need and then make an extension of it/add it to your backup.

Once that is done, you can manually run the timezone update script from a terminal window or make your own script.

The timezone data extract is explained in linux-from-scratch or, if needed, I can dig out what I did in dsl to achieve the same thing
I could not get any tarball on LFS, however, I downloaded Debian source package tzdata_2008i.orgig.tar.gz and extracted it but there is nothing to compile, then how to make tce? There are text files and one file is "Asia" which has Kolkata. How to use it?

I could not find any timezone update script on TC.

kagashe
Title: Re: How to change timezone?
Post by: Juanito on January 08, 2009, 04:02:43 AM
I'm stuck on a w2k machine at the moment, but it should go something like this:
Code: [Select]
$ sudo mkdir /tmp/tzdata
$ sudo chown tc:staff /tmp/tzdata
$ cd /tmp/tzdata
$ wget -c ftp://elsie.nci.nih.gov/pub/tzdata2008i.tar.gz
$ tar -zxvf tzdata2008i.tar.gz
$ zic -d zoneinfo asia [maybe Asia]
$ sudo cp zoneinfo/Asia/Kolkata /usr/share/zoneinfo/Asia/
$ sudo rm /etc/localtime
$ sudo cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

To test if it works (make sure you have a network connection and that your hardware clock is set to GMT/UTC), I think you need:
Code: [Select]
$ sudo getTime.sh

Title: Re: How to change timezone?
Post by: kagashe on January 08, 2009, 04:32:28 AM
Where is zic on TC? I have glib2 glib2-devs compiletc loaded.

kagashe
Title: Re: How to change timezone?
Post by: Juanito on January 08, 2009, 05:10:05 AM
Ah - good point, you get zic from compiling glibc.

Do you have access to a different linux distro where you can prepare your timezone file and then copy it across to tc?
Title: Re: How to change timezone?
Post by: kagashe on January 08, 2009, 05:52:28 AM
Ah - good point, you get zic from compiling glibc.

Do you have access to a different linux distro where you can prepare your timezone file and then copy it across to tc?
Yes, I have Ubuntu Hardy, Debian Lenny, Arch.

kagashe
Title: Re: How to change timezone?
Post by: kagashe on January 08, 2009, 06:24:17 AM
Ok. I got the hint and used zic on Ubuntu to prepare Kolkata file and copied it to /usr/share/zoneinfo/Asia and /etc/localtime.

However, running getTime.sh updates to UTC only and displayed time remains UTC.

kagashe
Title: Re: How to change timezone?
Post by: Juanito on January 08, 2009, 06:51:26 AM
You need to re-start jwm for the local time to be displayed
Title: Re: How to change timezone?
Post by: kagashe on January 08, 2009, 08:21:28 AM
You need to re-start jwm for the local time to be displayed
I tried restarting jwm also xserver. The clock still displays UTC and date command also shows UTC time.

kagashe
Title: Re: How to change timezone?
Post by: roberts on January 08, 2009, 08:47:52 AM
Is the NIST server responding? When run from an xterm it should display both UTC and local.
local is specified via /etc/localtime

You may wish to use a more local time server.
The getTime.sh will accept a parameter of a time server nearer you.
See the script /usr/bin/getTime.sh. It is one that I converted from lua.
Title: Re: How to change timezone?
Post by: kagashe on January 09, 2009, 08:29:14 AM
Assuming that the Kolkata file which I made on Ubuntu may not be working on TC, I tested the /usr/share/zoneinfo/Asia/Dubai file by linking it to /etc/localtime. It does not work, however, if I boot with tz=Asia/Dubai the clock displays Dubai time.

It is established that any link made to /etc/localtime after booting TC does not work.

I have working internet connection and "sudo getTime.sh" displays the following when I boot with tz=Asia/Dubai:
Fri Jan 9 16:21:30 UTC 2009
Fri Jan 9 20:21:30 GST 2009.

When I boot without tz=Asia/Dubai and change the timezone later by linking /etc/localtime to Dubai both lines display UTC only.

kagashe
Title: Re: How to change timezone?
Post by: kagashe on January 10, 2009, 02:02:37 AM
This is happening on default TC boot (without any tz= option) only.

If I boot with any other tz= option (even tz=Asia/Kolkata which does not exist) the changes to /etc/localtime are honored.

I have added /usr/share/zoneinfo/Asia/Kolkata and /etc/localtime to /opt/.filetool.lst and it works for me.

This thread is solved but I have submitted a bug report (http://forum.tinycorelinux.net/index.php?topic=403.0).

kagashe
Title: Re: [SOLVED] How to change timezone?
Post by: roberts on January 10, 2009, 05:37:33 AM
Just a comment. I notice that many posts contain instructions of adding system files to /opt/.filetool.lst.

While there is nothing wrong with it, it is not preferable.

The concept behind TC is modularity and the separation of static from dynamic data.

The preferred method would be to make a kolata.tce which contains the static system files and add it to your tce directory.

By doing this you keep the backup times shorter.
Title: Re: [SOLVED] How to change timezone?
Post by: tobiaus on January 10, 2009, 06:28:00 AM
While there is nothing wrong with it, it is not preferable...

The preferred method would be to make a kolata.tce which contains the static system files and add it to your tce directory.

there's no question that your way is more ideal, it's not only faster, it is more likely to keep your tc setup working in the long run.

the ideal way would be "preferable" too, if it was not easier (more friendly) to add a line to filetool.lst than it was to create a .tce. creating a .tce is not the most complicated task, but i find myself putting off doing it this way, even though it was the way i originally planned to do everything (avoid filetool.lst completely!) but it turned out to be extremely friendly!

if there was ever a handy tool for making .tce's by simply giving it the name of a folder to "zip up," where the folder contained the proper structure (like the source directory for a dsl remaster does) then i think more people would do things the ideal way. the thing about adding to filetool.lst is, you don't even have to think about what you're doing so much. one line of text, there you go, it's added now. (but it's not ideal, just easy.)
Title: Re: [SOLVED] How to change timezone?
Post by: roberts on January 10, 2009, 06:41:57 AM
Whether you add those lines to /opt/.filetool.lst or to say a separate list, mystuff.lst is the same effort.
You don't have to move or copy any files or directories to make your custom .tce

Then simply using the tar command

 tar -C / -T mystuff.lst -czvf mystuff.tce

seems pretty easy to me. Hardly worth creating a gui for a single command.
Title: Re: [SOLVED] How to change timezone?
Post by: tobiaus on January 10, 2009, 07:04:49 AM
simply using the tar command

tar -C / -T mystuff.lst -czvf mystuff.tce

no you're right.

that is pretty incredibly simple. :) i assumed too much, from reading about how to create proper .dsl files recently. (actually i just finished reading the chapters you wrote, i'm reading christopher negus's chapters now.) some of the simplifications in tc are really nice.
Title: Re: [SOLVED] How to change timezone?
Post by: kagashe on January 10, 2009, 08:31:19 AM
Just a comment. I notice that many posts contain instructions of adding system files to /opt/.filetool.lst.

While there is nothing wrong with it, it is not preferable.

The concept behind TC is modularity and the separation of static from dynamic data.

The preferred method would be to make a kolata.tce which contains the static system files and add it to your tce directory.

By doing this you keep the backup times shorter.
Thanks. I have made Kolkata.tce and deleted the entries in /opt/.filetool.lst

I have tested and it is working. I am attaching it to this post so that anyone from India can use it.

kagashe
Title: Re: [SOLVED] How to change timezone?
Post by: ^thehatsrule^ on January 10, 2009, 10:39:03 AM
that is pretty incredibly simple. :) i assumed too much, from reading about how to create proper .dsl files recently. [...] some of the simplifications in tc are really nice.
It's actually pretty much the same
Title: Re: [SOLVED] How to change timezone?
Post by: tobiaus on January 10, 2009, 08:09:01 PM
It's actually pretty much the same

well then it seems to be getting better, but without abandoning tradition. that's good too.
Title: Re: [SOLVED] How to change timezone?
Post by: roberts on January 12, 2009, 08:38:25 AM
After seeing the effort that Kagashe had to do just to add another city to get timezone support. I have decided to drop the zoneinfo database and simplify matters by using only offsets via the TZ variable. Look for this starting in the 1.1 version.