[CentOS] hwclock problem

Fri Nov 12 01:26:30 UTC 2010
Robert Moskowitz <rgm at htt-consult.com>

On 11/11/2010 06:41 PM, Jobst Schmalenbach wrote:
> Hi.
>
> I run peridocally (from cron) on all of my machines
>
>    30 * * * * root /sbin/hwclock --systohc
>
> All of those machines in question take their time via NTP
> from the same local server, and that server gets its time
> from a ntp pool.
>
> Now I had to reboot a couple of them two days ago and to my surprise
> all had problems with the time upon booting.
>
> Here are the important files:
>
> [root at XXXXXX ~] #>l /etc/adjtime
> 0.001687 1289518202 0.000000
> 1289518202
> LOCAL
>
> [root at XXXXXXX ~] #>l /etc/sysconfig/clock
> ZONE="Australia/Melbourne"
> UTC=false
> ARC=false
>
> So from my understanding the hwclock should contain the local time.
>
> [root at XXXXXX ~] #>date
> Fri Nov 12 11:26:23 EST 2010
> [root at XXXXXX ~] #>hwclock
> Fri 12 Nov 2010 11:26:42 EST  -0.167976 seconds
> [root at XXXXXX ~] #>
>
> However on boot I get the following:
>
> Nov 10 19:08:37 XXXXXX syslogd 1.4.1: restart.
> Nov 10 19:08:37 XXXXXX kernel: klogd 1.4.1, log source = /proc/kmsg started.
> Nov 10 19:08:37 XXXXXX kernel: Linux version 2.6.18-164.11.1.el5 (mockbuild at builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.
> 1.2-46)) #1 SMP Wed Jan 20 07:32:21 EST 2010
> Nov 10 19:08:37 XXXXXX kernel: Command line: ro root=/dev/sda2 vga=791
> Nov 10 19:08:37 XXXXXX kernel: BIOS-provided physical RAM map:
> ...
> ...
> Nov 10 19:08:51 XXXXXX kernel: IPv6 over IPv4 tunneling driver
> Nov 10 08:08:52 XXXXXX ntpdate[2464]: step time server 192.168.1.1 offset -39599.950905 sec
> Nov 10 08:08:52 XXXXXX xinetd[2447]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
>
> and off course dovecot falls over too "Time just moved backwards by 39599 seconds."
>
> Now, 39600s is 11 hours, which is (inc DST) *MY* offset from Greenwich.
>
>
> So what am I doing wrong?
> The idea of running hwclock is to make sure that exactly the problem with dovecot does NOT occur, and ntp does not have a coughing fit when the hardware clock is not close to the correct time upon booting.
> The last time I booted some of those machine was more than 200 days ago, so the hwclock will be skewed if I do not update it.

Have you looked at altering your /etc/sysconfig/ntpd file to directly 
update your hardware clock?