Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where are timezones set on most unix systems?

1 view
Skip to first unread message

Boltar

unread,
Aug 5, 2008, 4:44:01 AM8/5/08
to
I'm using a Suse linux system. I was under the impression that
changing the TZ variable changes your local session timezone , eg:
export TZ=EST

All it does however is change the timezone string printed by 'date',
it doesn't change the clock at all. I can do export TZ=EST5 which will
set the clock back (I'm in the UK) but I don't want to have to
manually tell it how many hours behind another zone is. Also if I
unset TZ the system still seems to know I'm in british daylight
saving. How? Can anyone explain how timezones work on unix to me or
point me to some sort of dummies guide link?

Thanks

B2003

Doug McIntyre

unread,
Aug 5, 2008, 12:10:23 PM8/5/08
to
Boltar <bolta...@yahoo.co.uk> writes:
>I'm using a Suse linux system. I was under the impression that
>changing the TZ variable changes your local session timezone , eg:
>export TZ=EST

Yes, for your process shell that you started. Environmental variables
aren't global. Ie. you can't magicly affect everything else just
because you changed a variable somewhere in some shell.

>All it does however is change the timezone string printed by 'date',
>it doesn't change the clock at all. I can do export TZ=EST5 which will
>set the clock back (I'm in the UK) but I don't want to have to
>manually tell it how many hours behind another zone is. Also if I
>unset TZ the system still seems to know I'm in british daylight
>saving. How? Can anyone explain how timezones work on unix to me or
>point me to some sort of dummies guide link?

It'll affect all processes started after you did it from your shell.

If you need the system set differently (ie. your windowing desktop),
then you need to change that environmental variable before everything
starts up in the process that launches all of that stuff..

You are assuming what you are tweaking makes global changes, and it
really just makes a change locally for you and any processes you
launch out of your shell since you set it.

Christopher W Aiken

unread,
Aug 5, 2008, 1:55:55 PM8/5/08
to
On 2008-08-05, Boltar <bolta...@yahoo.co.uk> wrote:
<snip>

> saving. How? Can anyone explain how timezones work on unix to me or
> point me to some sort of dummies guide link?
>
> Thanks
>
> B2003

Most/all Linux system have the time zones programmed into
system files. See: /usr/share/zoneinfo/* Just copy your
appropriate "zoneinfo" file to /etc/localtime and your system
will report the time according to the file info from the
"/etc/localtime" file.

--
e-Mail: chris at cwaiken dot net
Home: www.cwaiken.net

Boltar

unread,
Aug 6, 2008, 5:05:24 AM8/6/08
to
On Aug 5, 5:10 pm, Doug McIntyre <mer...@geeks.org> wrote:
> You are assuming what you are tweaking makes global changes, and it
> really just makes a change locally for you and any processes you
> launch out of your shell since you set it.

Yes I know , thats why I said "local session".

B2003

Boltar

unread,
Aug 6, 2008, 5:05:37 AM8/6/08
to
On Aug 5, 6:55 pm, Christopher W Aiken <cwai...@nospam.net> wrote:
> Most/all Linux system have the time zones programmed into
> system files. See: /usr/share/zoneinfo/* Just copy your
> appropriate "zoneinfo" file to /etc/localtime and your system
> will report the time according to the file info from the
> "/etc/localtime" file.

Thanks.

B2003

Stephane Chazelas

unread,
Aug 6, 2008, 11:40:11 AM8/6/08
to
2008-08-5, 17:55(+00), Christopher W Aiken:

> On 2008-08-05, Boltar <bolta...@yahoo.co.uk> wrote:
[...]

>> saving. How? Can anyone explain how timezones work on unix to me or
>> point me to some sort of dummies guide link?
[...]

> Most/all Linux system have the time zones programmed into
> system files. See: /usr/share/zoneinfo/* Just copy your
> appropriate "zoneinfo" file to /etc/localtime and your system
> will report the time according to the file info from the
> "/etc/localtime" file.

It may be a better idea to make it a symlink instead of copying
it. This way, if the files in /usr/share/zoneinfo are updated,
you'll benefit from the update (think of for instance, the
recent change to DST in some parts of the US).

Your system may have an api to configure it. For instance on
debian based systems, you should do:

dpkg-reconfigure tzdata

That will set /etc/localtime and /etc/timezone

--
Stéphane

0 new messages