Quickly sync/update time from a time server
A good server machine should always tick its clock with correct time. The best way to keep it in shape is to sync with a time server.
You can use any preferred time server to sync. I’m using public time servers here:
# ntpdate pool.ntp.org
5 Feb 11:17:00 ntpdate[3332]: step time server 220.225.252.202 offset -585.969659 sec
Network time update command (ntpdate) will contact the avaiable time server from public pool and sync time with it. Here in above example, offset is denoting that the clock was running ahead of time in my server.
To remain updated, you should put a cron entry to sync with time server every midnight:
# crontab -e
0 4 * * * * /usr/sbin/ntpdate pool.ntp.org
This will update/correct your time in server at 00:04 am every midnight. I’ve written a very quick trick to correct your time. If you are interested to study further, you can find detailed information here.
learn!