This service will be undergoing maintenance at 20:00 UTC, 2017-04-03. It is expected to last about 30 minutes
Bug 23811 - Timezone problems since RedHat 5x
Timezone problems since RedHat 5x
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: SysVinit (Show other bugs)
7.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-11 14:37 EST by Need Real Name
Modified: 2014-03-16 22:18 EDT (History)
2 users (show)

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


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-01-11 14:37:41 EST
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
/etc/sysconfig/clock.

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 14:40:56 EST
hwclock doesn't set the timezone.

The timezone is determined by /etc/localtime.
Comment 2 Need Real Name 2001-01-11 14:49:49 EST
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 14:54:43 EST
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 14:57:49 EST
In any case, hwclock *does* use the timezone info, as specified
by the zoneinfo files.
Comment 5 Need Real Name 2001-01-11 15:05:20 EST
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 00:09:01 EST
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.