The VM time is incorrect and will not update to the correct time using the the normal process nor will remain correct.
The Hyper-V Time Synchronization Service is unable to correct the system clock in the the VM if it is over 5 seconds off from the host.
This behavior is by design (Microsoft kb#2618634) and was due to reports of application issues when the Time Synchronization Service adjusted the clock on the VM.
By default, the VM will get its time from the host and the host will receive its time from BIOS. The rate at which the time drifts will be affected by the total load of the host server. The higher the total load, the more the time will drift.
- Pause and resume the VM.
- Stop and start the VM.
- Go to Hyper-V Manager console and disable and then enable the Time Synchronization option for the VM.
- Configure the VM to pull time from an external source (e.g. domain controller or NTP server). This requires the Time Synchronization option to be disabled on the host.
- Configure the host to pull time from an external source like domain controller or NTP server; and then verify if the VM is pulling time from the host OS through NTP.
- Create a script for cron to schedule time update on the server:
- You need to create the script using vi editor:
cd /etc/cron.hourlyvi ntpdate.sh
Change the pool.ntp.org to be whatever your time server is:
ntpdate -s pool.ntp.org
service crond reload
ntpdate -s time-a.nist.gov service crond reload
- Save and close the file.
- Add the following in order to run hourly in crontab:
This allows you to edit the root crontab.
The original file looks something like this:
*/10 * * * * /usr/sbin/logrotate /etc/logrotate.d/lighttpd
0 * * * * /usr/tmcss/bin/tlogger
15 0 * * * /usr/tmcss/bin/CDTPurge.sh
- Add a line to the script above:
19 * * * * /etc/cron.hourly/ntpdate.sh
The 19 means it will run every hour at the 19th minute. You can change this to any number you want.
- Save the file and make sure that the Time Synchronization option has been disabled on the host.