[[howto:virtualization:fix-drifting-clock-in-vmware-linux-host-windows-guest]]

Posted 28 December 2007 by Brendan Kidwell

Fix Drifting Clock in VMWare (Linux Host, Windows Guest)

I have a Windows virtual machine on my office computer running in VMWare Server. The real computer runs Ubuntu Linux. I've had a nagging problem with the clock in the virtual machine. It always registers the correct time when I boot up the virtual machine, but then it invariably drifts – sometimes hours in single work day. I can't remember whether it drifts ahead or back or in both directions.

If you don't have VMWare Tools running, all bets are off.

I tried was disabling the service called Windows Time found Control Panel → Administrative Tools → Services. I don't remember where I picked up this hint [citation needed]. So far this change has failed to fix my problem on its own.

References:
http://blog.autoedification.com/2006/11/vmware-guest-clock-runs-fast.html
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1591

View /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq on the host. You will find a single line giving the maximum speed in kilohertz. Call that MAXKHZ. Now add these lines to /etc/vmware/config on the host, substituting your actual value for MAXKHZ:

host.cpukHz = MAXKHZ
host.noTSC = TRUE
ptsc.noTSC = TRUE

Then shutdown any virtual machines and restart VMWare Server with this command:

sudo /etc/init.d/vmware restart

I presume that step 2, and of course step 1, are required for step 3 have the correct effect. As of 28 December, have implemented step 3 right now, and I'll see how it works after a few days.

To comment on this page, please copy and paste the following into an email and send it to me. Useful and informative comments will be published within a day or two.

To: brendan@glump.net
Subject: Glump.net comment - Fix Drifting Clock in VMWare (Linux Host, Windows Guest)

Regarding: https://www.glump.net/howto/virtualization/fix-drifting-clock-in-vmware-linux-host-windows-guest
My name: [your name here]
My social media or web site: [optional URL here]
Publish this comment: yes

[your comment here]