Bug 438337 - Wrong usage of hwclock in /etc/rc.d/init.d/halt
Wrong usage of hwclock in /etc/rc.d/init.d/halt
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
rawhide
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-20 09:23 EDT by Boyan Anastasov
Modified: 2014-03-16 23:13 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-20 10:51:46 EDT
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 Boyan Anastasov 2008-03-20 09:23:34 EDT
Description of problem:
Somewhere at the beginning of March 2008 I've noticed that after boot the time
is not correct, but I'm rebooting rarely to be annoyed too much. Today I've
tried to find what is the reason for this. The time after boot is 2 hours ahead.
In fact GMT+2 hours is my current timezone (EET). It appears that the system
time is set from /etc/rc.d/init.d/halt using options from /etc/sysconfig/clock.
What it shows for me is:
ZONE="Europe/Sofia"
UTC=false
ARC=false

Which means the hardware clock is not in UTC, at least this was the meaning for
long time.

/etc/rc.d/init.d/halt is using this to figure out what time to set:
CLOCKDEF=""
CLOCKFLAGS="$CLOCKFLAGS --systohc"

case "$UTC" in
   yes|true)
        CLOCKFLAGS="$CLOCKFLAGS -u";
        CLOCKDEF="$CLOCKDEF (utc)";
        ;;
   no|false)
        CLOCKFLAGS="$CLOCKFLAGS --localtime";
        CLOCKDEF="$CLOCKDEF (localtime)";
        ;;
esac

which shows that for me the options used will be:

CLOCKFLAGS=" --systohc --localtime"

If I understand correctly from the man page of hwclock this means that hwclock
will think that the hardware clock is kept in UTC which is not correct.
For the proof I've performed couple reboots and the time after every reboot
advanced 2 hours ahead.

I think the case with $UTC must be vice versa, eg:

case "$UTC" in
   yes|true)
        CLOCKFLAGS="$CLOCKFLAGS --localtime";
        CLOCKDEF="$CLOCKDEF (utc)";
        ;;
   no|false)
        CLOCKFLAGS="$CLOCKFLAGS -u";
        CLOCKDEF="$CLOCKDEF (localtime)";
        ;;
esac


Version-Release number of selected component (if applicable):
initscripts-8.65-1.i386 have this problem. I think couple of the last versions
too beginning from March at least.
Comment 1 Bill Nottingham 2008-03-20 10:51:46 EDT
halt shouldn't be using /etc/sysconfig/clock at all.

Fixed in
http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=1b76162517a5e742201e7c7974a2d6e0d437f789

You may want to check your /etc/adjtime file to make sure that the right value
is on line 3 (UTC or LOCAL)

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