Create a script that connects to a reliable time server and retrieves the time:
#!/bin/bashNow, add two entries to crontab:
# Sync HWClock to timeserver.mynetwork.local
/bin/date
/sbin/service ntpd stop
/usr/sbin/ntpdate 192.168.0.50
/sbin/hwclock --systohc
/sbin/service ntpd start
/bin/date
1 */1 * * * /var/scripts/scheduled/synctime >> /var/log/synctime.logYou can certainly adjust the times, this is set to get the real time once an "hour" at the 1. Then sync the OS from the VM hardware clock every 2 minutes.
*/2 * * * * /sbin/hwclock --hctosys
Sample output of synctime:
Mon Nov 13 16:01:01 EST 2006
Shutting down ntpd: [ OK ]
13 Nov 16:04:46 ntpdate[19413]: step time server 192.168.0.50 offset 223.590418 sec
ntpd: Synchronizing with time server: [FAILED]
Starting ntpd: [ OK ]
Mon Nov 13 16:04:49 EST 2006