[asterisk-users] hardware clock drift and CDR

Vieri rentorbuy at yahoo.com
Mon Apr 26 07:33:41 CDT 2010



--- On Sun, 4/25/10, Gordon Henderson <gordon+asterisk at drogon.net> wrote:

> > Hi,
> >
> > I've noticed that one of my new servers (new mobo) if
> drifting slowly 
> > backwards in time (in aprox. 24 hours, system time
> drifts back 5 
> > minutes).
> >
> > I have an ntpd process which is supposed to sync with
> a lan time server 
> > but it's not quite working. So I'm launching a manual
> ntpdate or 
> > ntp-client once an hour and that seems to work.
> 
> If you can run ntpdate and it sets the time, then you are
> not running 
> ntpd. The 2 can not run at the same time.

Hi Gordon,

Are you sure about this? ntpd is a daemon and adjusts the time in a continuous manner. ntp-client or ntpdate or whatever are one-time clients that reset the system clock. I don't see why an ntp-client can't be run while ntpd is working (it shouldn't be necessary but may come in handy when the time difference is big and ntpd refuses to sync).

Anyway, I've noticed that my ntpd log messages don't say "anything" when trying to sync to my "Windows PDC LAN time server". Curiously, ntp-client DOES sync to this Windows server.
So I decided to sync to pool.ntp.org and now I see syslog messages that actually show that the system time gets adjusted by ntpd.

I'd rather sync to my LAN time server but this is off-topic on this ML.

> > How does Asterisk CDR count the duration/billsec
> values? Does it rely on 
> > system time ONLY for "call start" or also for "call
> end"?
> >
> > What Asterisk-related side-effects should I expect
> from a drifting 
> > clock?
> 
> Who cares. Just fix ntpd then your worys are gone.

Well, I still have doubts about that. I could look at * source code but I'd rather hear from someone here.

My ntp log shows this:

26 Apr 13:06:30 ntpd[534]: synchronized to xxx.xxx.xxx.xxx, stratum 2
26 Apr 13:21:24 ntpd[534]: time reset +2.318647 s
26 Apr 13:21:44 ntpd[534]: synchronized to xxx.xxx.xxx.xxx, stratum 2
26 Apr 13:37:46 ntpd[534]: time reset +2.325417 s
26 Apr 13:38:06 ntpd[534]: synchronized to xxx.xxx.xxx.xxx, stratum 2
26 Apr 13:54:11 ntpd[534]: time reset +2.327974 s
26 Apr 13:55:19 ntpd[534]: synchronized to xxx.xxx.xxx.xxx, stratum 2
26 Apr 14:09:16 ntpd[534]: time reset +2.177572 s
26 Apr 14:10:08 ntpd[534]: synchronized to xxx.xxx.xxx.xxx, stratum 2
26 Apr 14:26:07 ntpd[534]: time reset +2.357017 s

That kind of scares me because if I'm not mistaken it means that about every 20 seconds, my ntpd adjusts the system time by about 2 seconds forward. So my clock is going back 2 seconds every 20... That's a significant drift. And it would definitely make a difference in my CDR records IF Asterisk were to compare the "start and end" system times.

Should I worry about this?

Vieri



      



More information about the asterisk-users mailing list