Bug 13290 - hwclock & setclock broken if UTC desired
hwclock & setclock broken if UTC desired
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: util-linux (Show other bugs)
6.2
i586 Linux
medium Severity low
: ---
: ---
Assigned To: Erik Troan
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-06-30 15:37 EDT by david.to
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-02-26 12:30:07 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 david.to 2000-06-30 15:37:56 EDT
Two things (related):

0) SETCLOCK cannot interpret linuxconf-written value

   System: RedHat 6.0 2.2.12-29.4 (actually a VALinux RedHat)
   on an Intel board
   /etc/sysconfig/clock contained:
   ZONE="Europe/Luxembourg"
   UTC="yes"
   ARC=false
   written by linuxconf. setclock did NOT understand this
   (did not see I wanted UTC in the hardware clock). I had to change
   the file:
   ZONE="Europe/Luxembourg"
   UTC=true
   ARC=false
   ...which solved the problem.

1) SETCLOCK/HWCLOCK cannot see I want UTC

   System: RedHat 6.2 2.2.14-5 (directly from freshly bought RedHat CD)
   on an Intel board (...old one)
   setclock does not seem to consider /etc/sysconfig/clock correctly.
   I'm running system clock in local time (UTC+2).
   /etc/sysconfig/clock says:
   ZONE="Europe/Luxembourg"
   UTC="yes"
   ARC=false
   This has been freshly written by linuxconf.
   I want the hardware clock to run in UTC, so I do: 'setclock'
   The hwclock stays in local time! Tried 'UTC=true' in the 
   /etc/sysconfig/clock, which did not work
   either. Tried 'hwclock --utc --systohc', which did not work either.
   Even 'hwclock --set --utc --date="`date -u`"' does not work.
   Checked with success whether hwclock can set the date at all.
   Problem is circumvented by doing a 'hwclock --set --date="<date>"
   with <date> the UTC date.
Comment 1 David Tonhofer 2001-02-26 11:03:28 EST
Retested the case under newly installed RedHat7.0
on the same machine; the problem is still there:

/etc/sysconfig/clock says:

   ZONE="Europe/Luxembourg"
   UTC=true
   ARC=false

I do:

   date 022616462001.50
   setclock
   date;date -u;hwclock

 Mon Feb 26 17:02:29 CET 2001 
 Mon Feb 26 16:02:29 UTC 2001
 Mon Feb 26 17:02:30 2001  0.306271 seconds
Comment 2 David Tonhofer 2001-02-26 12:30:03 EST
Full backpedal -- it's case closed, Watson. At least for the RedHat 7.0
system. I will come back with results of the 6.2 soon, just have to swap the
harddisks.

So, it actually works as expected and I didn't realize it. Sorry
for the trouble, people. I will do a hundred push-ups as penance. Here's the
recipe:

 - date <localtime>  (sets the system clock)
 - setclock          (sets the hardware clock from the system clock. localtime
                      is converted to UTC if /etc/sysconfig/clock says so)

Alternatively, one can use the hardwareclock first, the systemclock second:

 - hwclock --set --utc --date=<localtime>

This means: set the hwclock to the <locatime> and assume that the hwclock 
should be in UTC. 

 - hwclock --hctosys --utc

This means: set the system clock from the hardware clock assuming the
hardware clock is in UTC; the timezone correction is made automagically.

We verify, being in timezone UTC+1:

 - date;date -u;hwclock --utc;hwclock --localtime

 Sat Feb 26 17:47:33 CET 2000          System clock localtime
 Sat Feb 26 16:47:33 UTC 2000          System clock UTC 
 Sat Feb 26 17:47:34 2000  0.776101 s  Hwclk in localtime if hwclock in UTC
 Sat Feb 26 16:47:35 2000  0.975892 s  Hwclk in localtime if hwclock in loctime

which is what we expect!


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