2

I have linux redhat machine

# more /etc/redhat-release
Red Hat Enterprise Linux Server release 5.11 (Tikanga)

I want to change the hwclock to UTC time

So I perform little test as

# date -u
Tue Jul 26 10:01:53 UTC 2016

more /etc/sysconfig/clock
ZONE="Asia/Tokyo"

hwclock --show
Tue Jul 26 19:02:17 2016  -0.768566 seconds

And now I will set the hwclock to UTC

hwclock --systohc --utc

But the hwclock not change to UTC time ?

# hwclock --show
Tue Jul 26 19:02:56 2016  -0.534987 seconds

I also change the /etc/sysconfig/clock and append the line UTC=yes

 # vi /etc/sysconfig/clock

 # more /etc/sysconfig/clock
 ZONE="Asia/Tokyo"
 UTC=yes

But from hwclock -- show I get non UTC time

 # hwclock --show
 Tue Jul 26 19:06:56 2016  -0.786752 seconds

I try again by the following command but without success

 # hwclock --systohc --utc

 # hwclock --show
 Tue Jul 26 19:07:07 2016  -0.399765 seconds

I reboot the machine to see if I get UTC hwclock after restart but without success

 # reboot

 Broadcast message from root (pts/0) (Tue Jul 26 19:07:13 2016):

 The system is going down for reboot NOW!

After machine reboot I perform the following , but still cant configure hwclock to UTC -:(

 # hwclock --show
 Tue Jul 26 19:11:05 2016  -0.697674 seconds

 # hwclock --systohc --utc

 # hwclock --show
 Tue Jul 26 19:11:15 2016  -0.838524 seconds

Please advise why I not get UTC time by the hwclock command

Machine HW info

# dmidecode | grep -i hp
       Vendor: HP
       Manufacturer: HP
       Manufacturer: HP
HP ProLiant System/Rack Locator
HP BIOS PXE NIC PCI and MAC Information
HP BIOS iSCSI NIC PCI and MAC Information

I run the hwclock with debug as:

  hwclock --systohc --utc --debug
  hwclock from util-linux-2.13-pre7
  Using /dev/rtc interface to clock.
  Last drift adjustment done at 1469527871 seconds after 1969
  Last calibration done at 1469527871 seconds after 1969
  Hardware clock is on UTC time
  Assuming hardware clock is kept in UTC time.
  Waiting for clock tick...
  /dev/rtc does not have interrupt functions. Waiting in loop for time   from /dev/rtc to change
 ...got clock tick
  Time read from Hardware Clock: 2016/07/26 11:17:36
  Hw clock time : 2016/07/26 11:17:36 = 1469531856 seconds since 1969
  Time elapsed since reference time has been 0.993984 seconds.
  Delaying further to reach the next full second.
  Setting Hardware Clock to 11:17:36 = 1469531856 seconds since 1969
  ioctl(RTC_SET_TIME) was successful.
  Not adjusting drift factor because it has been less than a day since the   last calibration.
5
  • Is this really a machine? Or is it perhaps a VPS, or a containerised environment?
    – MadHatter
    Jul 26, 2016 at 10:46
  • this is real redhat linux machine version 5.X
    – dandan
    Jul 26, 2016 at 11:00
  • please see mu update ( I give here the results from dmidecode )
    – dandan
    Jul 26, 2016 at 11:02
  • "the time shown is always in localtime" linux.die.net/man/8/hwclock
    – Massimo
    Sep 1, 2018 at 7:13
  • Try hwclock --debug. You'll see if hwclock is set to utc and its time in utc.
    – Louis Go
    Apr 13, 2022 at 2:48

0

You must log in to answer this question.

Browse other questions tagged .