System looses time

My system looses time about 1 hour per day.

asterisk 1.4.6

Is there somewhere I can set the date/time to update frequintly?

I did set in etc/profile

Thank You


You can setup ntpd, or you could run rdate, or run ntpdate via a cron job. Personally I use ntpd

It looks like my system has ntp there is a file etc/ntp.conf

riftfile /var/lib/ntp/drift
fudge stratum 10

Is there something I need to do to get it to run?

Thank you


What Linux Distro is this? If it is a Red Hat like system (Fedora, CentOs,TrixBox, etc…) you can make sure the service is being started at boot

chkconfig --list|grep ntp

ntpd            0:off   1:off   2:off   3:on    4:off   5:on    6:off

If its on for 3 then you’re good, if its not then you should do this next command as root

chkconfig ntpd on
service ntpd start

If its not a Red Hat like system then you should consult the documentation for adding services to the startup. If the service is already running and started but its still not keeping the time correct you should look into seeing if the servers you are using are in fact correct and do run the ntp service for you to be able to update from.

man 5 ntp.conf

The above command may come in handy if you suspect troubles with your ntp.conf file

fyi: here are some of the reasons a system looses time over time. The box is over taxed, when that happens it can start spending to much time chunks of the code where it blocks interrupts so it does not update the clock tracking properly.

If the box is older the battery might be getting weak when that happens the onboard clock will start to run a bit slower and loose time.

If it is running in a VM that is very common and depending on the VM being used you qwill need to adjust the clock ticks to make it more accurate.

And last but not least my favorite if the MB is a real cheap one that’s one place they cut in manufacturing to save costs…

But setting up ntpd is a real good way to keep it in sync.