Tech Support > Operating Systems > Linux / Variants > Time zone bizzarness
Time zone bizzarness
Posted by Yan Seiner, PE on February 2nd, 2004


I am running a Fedora Core 1 system. I have the system set to UTC and the
hardware clock correctly set (I think).

Yet date returns TZ-5, or UTC.

[yan@hamlet yan]$ date --utc
Mon Feb 2 09:46:43 UTC 2004
[yan@hamlet yan]$ date
Mon Feb 2 04:46:45 EST 2004
[yan@hamlet yan]$

The first is the correct local time; the second is not.

I've looked all around, and everything seems OK.

hwclock seems to know what's going on:

[yan@hamlet yan]$ /sbin/hwclock --localtime
Mon 02 Feb 2004 09:48:26 AM EST -0.292508 seconds
[yan@hamlet yan]$ /sbin/hwclock --utc
Mon 02 Feb 2004 04:48:32 AM EST -0.129839 seconds
[yan@hamlet yan]$

Again, localtime is correct, utc is correct.

But my clock and date insist on returning utc, not localtime.

Where to look?

--Kamus


--
o
/\ /_ o__
o* ~(_) ,>/'_ o__
Yan Seiner, PE (_)\(_) ,>/'_ o__ o__
Cardinal Engineering, Inc. (_)\(_) ,>/'_ ,>/'_
http://www.cardinalengineering.com (_)\(_) (_)\(_)
spam killer code kpwq1jkcsEzdx39gnkVvgycd15ayqq


Posted by Barry L. Bond on February 2nd, 2004


In article <pan.2004.02.02.09.50.39.370662@cardinalengineerin g.com>,
Yan Seiner, PE <yan@cardinalengineering.com> wrote:

Do you have a file /etc/localtime?

Mine, I had to link (ln -s) to /usr/share/zoneinfo/EST5EDT, and
things have been okay since then.

Barry
--
Barry L. Bond
bbond@cfl.rr.com <- personal
72235,1530 (CIS) <- personal

Posted by chris-usenet@roaima.co.uk on February 3rd, 2004


Yan Seiner, PE <yan@cardinalengineering.com> wrote:
OK, so the system's running UTC (a good idea). What timezone are you
in? Eastern?

Hmm. Not sure how au fait you are with timezones and the like, so I'll
try to explain. Forgive me if this is all obvious to you.

1. Ideally, the system should run on UTC regardless of where in the
world it's located. Running "date --utc" should NOT give you the
correct local time unless you happen to be in a part of the world
where UTC really is the same as local time.

2. Your view of the system's time should be specific to your location.
Similarly for your users (if any). This is defined by the timezone,
and changed (on my debian system) by running tzconfig [1].

3. Once you've set the correct timezone, a simple "date" should show
you the correct local time, and "date --utc" should show you UTC.

Assuming you're trying to be on EST, then UTC will be five hours ahead
of your local time. It's 17.21 UTC here, which is the same as 5.21pm GMT,
which is the same as 12.21pm EST, which is the same as 9.21am PST. To
you, the time on my system could be 12.21pm EST, while to me it would
be 5.20pm GMT.

The key here is that it's the *same* time, just with different
representations.

Chris


[1] Actually, you can simply symbolically link /etc/localtime to the
appropriate entry under /usr/share/zoneinfo/ if you prefer. Mine's
Europe/London.