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
just before the line
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.
hwclock doesn't set the timezone.
The timezone is determined by /etc/localtime.
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.
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?
In any case, hwclock *does* use the timezone info, as specified
by the zoneinfo files.
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).
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.