Time difference between hwclock and date

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Time difference between hwclock and date

Postby phil_discount » Tue Feb 25, 2014 10:06 am

Hello!

is this a problem?
hwclock shows me allways time differences about 0.5s and 1.1s the whole day.

Code: Select all
vicidial2:~ # hwclock
Tue Feb 25 16:55:25 2014  -0.766472 seconds


i've got a cronjob to sync time every 5 minutes
*/5 * * * */etc/init.d/ntp ntptimeset

regards
philip
ViciBox Redux 3.0.5 | Vicidial 2.2.1-260 100527-2211 | Asterisk 1.4.27.1
9xVicidial 8-core 2.5GHz,4GB,SSD
4xWeb 4-core 2.5GHz,4GB,SSD
DB: 24-core-1.9GHz AMD,96GB,8xSSD Raid10
3xDBslave 4-core 2.5GHz,4GB,SSD (for SELECT: Reporting/LIVE)
400 seats
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Re: Time difference between hwclock and date

Postby williamconley » Tue Feb 25, 2014 12:09 pm

You've been in open source too long. Catch up. LOL

ntp is NOT used in that fashion any more. It is now a service. Each time you "set" the time, you break that services ability to "sync".

ntp.conf is designed to allow configuration of the ntp daemon which syncs on a continuing basis and keeps track of "how far off" in data files and eventually adjusts itself to maintain proper time precisely (even under heavy load).

since hwclock is only used to set the time during startup, and is usually set to the current time at reboot, it's not used during the day by any process directly (except the ntp daemon, which sets the system time and uses its internal offsets to make that perfect). But if you "reset" time every 5 minutes, this process will never actually happen and your system will never sync.

in opensuse, you can also use "yast" to set the servers to which time will sync.

in a cluster you would have only one server (usually the db, but any server will do) check externally and all the other servers will sync to that one. thus all servers in the cluster will have one time. we also use iburst in this situation to speed the sync process.

in short: hwclock is not meant to have the perfect time. it's job is to go at the same speed all day. ntp uses that constant speed and external time servers with perfect time to Calculate perfect time and modify the server time accordingly. so don't mess with the ntp daemon's ability to complete this process

But how do you know if the ntp daemon is "synced"?
Code: Select all
ntpq -p


If a server listed has a + or * in the left column, the server has synced with that external time service. If none have this symbol, it is attempting to sync but has not yet succeeded. This process normally takes more than 5 minutes. If you "reset" time every 5 minutes, it will never succeed. In fact, even if it does succeed all that data will be deleted when you "set" the time.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Time difference between hwclock and date

Postby geoff3dmg » Tue Feb 25, 2014 12:11 pm

The hardware clock is only used at system startup. It's updated on shutdown. Thus your server will only have time issues if it is offline for a long period of time. If so, the hwclock command will set the system time to a value that cannot be corrected by NTP because it has drifted too far. Thus your server will have an incorrect time set.
Vicibox 5.03 from .iso | VERSION: 2.10-451a BUILD: 140902-0816 | Asterisk 1.8.28.2-vici | Multi-Server | Amfeltec H/W Timing Cards | No Extra Software After Installation | Dell PowerEdge 1850 | Pentium 4 'Prescott' Xenon Quad @ 3.40GHz
geoff3dmg
 
Posts: 403
Joined: Tue Jan 29, 2013 4:35 am
Location: Lancashire, UK

Re: Time difference between hwclock and date

Postby phil_discount » Tue Feb 25, 2014 1:01 pm

perhaps thats the reason why we've got sometimes strange behaviour with vicicidal_agent_log and call disconnects? :-)

i will test it and give feedback

thanks!
ViciBox Redux 3.0.5 | Vicidial 2.2.1-260 100527-2211 | Asterisk 1.4.27.1
9xVicidial 8-core 2.5GHz,4GB,SSD
4xWeb 4-core 2.5GHz,4GB,SSD
DB: 24-core-1.9GHz AMD,96GB,8xSSD Raid10
3xDBslave 4-core 2.5GHz,4GB,SSD (for SELECT: Reporting/LIVE)
400 seats
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Re: Time difference between hwclock and date

Postby phil_discount » Tue Feb 25, 2014 4:22 pm

the database server sync via ntp (yast) the from the internet.
every cluster- and webserver has also ntp configured but only with the databaseserver as ntp server.

right?
ViciBox Redux 3.0.5 | Vicidial 2.2.1-260 100527-2211 | Asterisk 1.4.27.1
9xVicidial 8-core 2.5GHz,4GB,SSD
4xWeb 4-core 2.5GHz,4GB,SSD
DB: 24-core-1.9GHz AMD,96GB,8xSSD Raid10
3xDBslave 4-core 2.5GHz,4GB,SSD (for SELECT: Reporting/LIVE)
400 seats
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Re: Time difference between hwclock and date

Postby williamconley » Tue Feb 25, 2014 4:58 pm

correct.

and if you use the iburst keyword, they will sync faster after a reboot.

use the command given below to check for sync between servers and to check that the db server is synced to external servers.

be careful about using "pool" servers as it can be invitation to attack (we use government only)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Time difference between hwclock and date

Postby phil_discount » Tue Feb 25, 2014 6:00 pm

the database is syncing with internet, but how can i check if the clusterservers are syncing with the database server?
Code: Select all
ka-vici-mysql:~ # ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+iris.wf-hosting 62.149.0.30      2 u  584 1024  377   18.136    4.859   0.825
*ntp2.m-online.n 212.18.1.106     2 u   75 1024  377   13.109    4.194   0.923
-master.stbuehle 131.188.3.221    2 u  141 1024  377   13.257   -2.593   1.095
+195.50.171.101  145.253.3.52     2 u  682 1024  377    5.786   -1.417   2.332


there's a * in front of the databaseserver. seems to be ok or not?
Code: Select all
ka-vici-dialercluster8:~ # ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ka-vici-mysql.s 212.18.3.19      3 u    8 1024  377    0.108    1.287   0.415


iburst is activated.

thanks for help!!

UPDATE: i found the command
Code: Select all
ntpdc -c monlist

then i see every cluster and webserver is synced
ViciBox Redux 3.0.5 | Vicidial 2.2.1-260 100527-2211 | Asterisk 1.4.27.1
9xVicidial 8-core 2.5GHz,4GB,SSD
4xWeb 4-core 2.5GHz,4GB,SSD
DB: 24-core-1.9GHz AMD,96GB,8xSSD Raid10
3xDBslave 4-core 2.5GHz,4GB,SSD (for SELECT: Reporting/LIVE)
400 seats
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Re: Time difference between hwclock and date

Postby williamconley » Tue Feb 25, 2014 11:22 pm

* means sync'd :) as does +

not sure what monlist does, but it does not seem to specify sync'd or not so be careful. :)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 117 guests