Bug 23811 - Timezone problems since RedHat 5x
Summary: Timezone problems since RedHat 5x
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: SysVinit   
(Show other bugs)
Version: 7.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-01-11 19:37 UTC by Need Real Name
Modified: 2014-03-17 02:18 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-01-11 20:05:24 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Need Real Name 2001-01-11 19:37:41 UTC
File:  /etc/rc.d/rc.sysinit

For hwclock to set the kernel's timzone, you must set the TZ variable
before calling hwclock.  If you don't set the kernel's timzone properly,
programs which depend on it will be messed up (I believe that every clock
in RedHat qualifies, as well as the date command).

I've had problems with this since (at least) RedHat 5.x.

To fix, add a line like
  export TZ=$ZONE
just before the line
  /sbin/hwclock $CLOCKFLAGS
in /etc/rc.d/rc.sysinit, so long as the ZONE variable is set in

I would also like to recommend setting TZ in a similar way in /etc/profile,
or some other appropriate place.

-Paul Komarek

Comment 1 Bill Nottingham 2001-01-11 19:40:56 UTC
hwclock doesn't set the timezone.

The timezone is determined by /etc/localtime.

Comment 2 Need Real Name 2001-01-11 19:49:49 UTC
The bug I'm reporting is that you don't use hwclock to set the timezone in the
kernel.  Thus the kernel always has the timezone wrong.  Despite what the
hwclock manpage says about nobody caring what timezone the kernel thinks it's
in, programs like 'date' do seem to care.  For instance, try configuring a
machine with the hardware clock set to Pacific Time (POSIX is Los Angeles),
using the RedHat installer.  I expect (because I have experienced it first hand
multiple times) that 'date', as well as clocks on your desktop, will report
incorrect time--in particular, plus or minus 3 hours.

-Paul Komarek

Comment 3 Bill Nottingham 2001-01-11 19:54:43 UTC
This works fine here. What does your /etc/sysconfig/clock say,
and what is /etc/localtime a copy of?

Also, are you *positive* that your hardware clock is set
as it is configured?

Comment 4 Bill Nottingham 2001-01-11 19:57:49 UTC
In any case, hwclock *does* use the timezone info, as specified
by the zoneinfo files.

Comment 5 Need Real Name 2001-01-11 20:05:20 UTC
My RedHat 6.1 and 7.0 machines don't have zoneinfo files (i.e.
/usr/lib/zoneinfo, as spec'd by the hwclock page).  I do have stuff in
/usr/share, but I have no indication that hwclock is going to look at this
stuff.  I'll go break one of my machines and see what I can come up with, since
you don't seem to have ever had this hair-pulling problem.

My /etc/localtime is identitical to /usr/share/zoneinfo/US/Eastern.  However, I
expect you want to know what my sister's /etc/localtime says, since she is in
the Pacific timezone (I'm Eastern, but I still have had problems).

-Paul Komarek

Comment 6 Need Real Name 2001-01-12 05:09:01 UTC
I wasn't able to reproduce the problem on my extra machine, and I verified that
the problem I formerly had with RedHat 6.1 was indeed the known apmd problem in
RedHat 6.1.  So the problem I'm reporting is, AFAIK, only in RedHat 7.0 with
updates through Dec. 17th-ish, 2000 -- my mistake, sorry.

To verify the problem, I called my sister.  In fact her /etc/localtime was
Eastern, not Pacific.  However, her /etc/sysconfig/clock's ZONE line was
US/Pacific.  Much as I'd like to blame this on Anaconda, the simpler explanation
is that I screwed up during installation, then changed /etc/sysconfig/clock
manually (though I don't remember doing this), and then my TZ changes overrided
/etc/localtime for hwclock.

The only question remaining for me, then, is why TZ isn't set in /etc/profile at
installation for any programs that might use it--or aren't there any?

Sorry for the (probable) red herring.
-Paul Komarek

Note You need to log in before you can comment on or make changes to this bug.