Hardware and system timing are different

-> We have 2 servers server1 and server2 server.
->server1 is master application and server2 is slave application server. ->output of server1 hardware and slave timing:

#  hwclock --show Thu 05 Jun 2014 05:34:08 PM SGT  -0.465666 seconds # date Thu Jun  5 17:34:16 SGT 2014 
# cd /etc/sysconfig/ 

# ls -ltr clock* -rw-r--r-- 1 root root 179 Jul  3  2008 clock 

# cat clock 
# The ZONE parameter is only evaluated by system-config-date. # The timezone of the system is defined by the contents of  /etc/localtime. 
ZONE="Asia/Singapore" 
UTC=false 
ARC=false 
*************
#   ->output of server2 server hardware and software info: 

#  hwclock --show Thu 05 Jun 2014 04:02:23 PM SGT  -0.225825 seconds 
# date Thu Jun  5 17:05:05 SGT 2014 
#  hwclock --show Thu 05 Jun 2014 04:13:40 PM SGT  -0.436206 seconds # date Thu Jun  5 17:15:14 SGT 2014
# cd /etc/sysconfig/ 
# cat clock
 # The ZONE parameter is only evaluated by system-config-date.
 # The timezone of the system is defined by the contents of  /etc/localtime. ZONE="Asia/Singapore"
 UTC=false 
ARC=false 

# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.7 (Tikanga) #   ->There is a change in the hardware and linux system time change.

-> We know how to change the system and hardware timing.
-> Need advice if we want to change the hardware and system timing then what is the procedure and impact on server appllicationa.
->Kindliy assist.

Have a look at the date command manual page:-

man date

That should let you set the system clock. Take care considering the time zone.

Why is the hardware clock important to you?

Also have a look at the clock manual page:-

man clock

I hope that this helps,

Robin

Hi Robin,

Thanks for your reply.

1)for hardware clock, I will use cmd :

hwclock --set --date "05/06/2013 17:34:08"

2) Setting System timing to according to Hardware timing:

# hwclock -s 

or

# hwclock -hctosys

Please advice either hardwae to system timing copy will be ok or system to hardware timing ok?

3) We have already set the time zone so I will not change it.

4) We have some application running over these system where server1 is master and server2 as slave. kindly also advice that we need to stop out application or without stopping, we can proceed for time change?

5)I checked on the internet and mentiond like hardware clock always keep running even after the server is in shutdown status while system clock depends on kernal. once linux OS is shutdwon then system clock stop running.

Kindly Advice...

Usually you sync the system time between your servers with the NTP protocol.
And sync the system time to the HW clock during shutdown.

Yes, you are correct. Instead of manually changing or updating time, I restarted the ntp serices. I found the reason of this time difference that last week this server rebooted and ntp services was not running. After restarting ntp services, automatically system timing synced with ntp server. Application was not depend on this timing so without stopping application, I am able to do this.

After this, using below command I synced hardware timing to system timing:
hwclick --systohc

Thanks guys for your help in solving this issue.

To ensure that ntpd is started at system boot, ensure the following:
1.

chkconfig --list | grep ntp

says ntpd ... 3:on 4:on 5:on ...
(and your current runlevel, who -r , is 3 or 4 or 5.
2.
ntpd runs with -g option.

Hi Guys!!!

->I checked the output on my both server and showing below output:

************

Server01
[root@server01 ~]# chkconfig --list | grep ntp
ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@server01 ~]# ps -ef |grep ntp
ntp       4135     1  0 May30 ?        00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
root     17003 16771  0 18:52 pts/0    00:00:00 grep ntp
[root@server01 ~]# who -r
         run-level 3  2014-05-30 16:06                   last=S
[root@server01 ~]# date
Thu Jun 19 18:53:10 SGT 2014
[root@server01 ~]#

************
Server02

[root@server02 ~]# chkconfig --list | grep ntp
ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@server02 ~]# ps -ef |grep ntp
root     15332 15261  0 18:55 pts/0    00:00:00 grep ntp
ntp      25876     1  0 Jun10 ?        00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
[root@server02 ~]# date
Thu Jun 19 18:55:49 SGT 2014
[root@server02 ~]#

***************

->That means that after system reboot ntp services will automatically start.

Thanks guys for your help and support. Without getting ans from you guys, resolving issue was difficult.
Now my issue solved.