Search the VMware Knowledge Base (KB)
View by Article ID

Time runs too fast in a Windows virtual machine when the Multimedia Timer interface is used (1005953)

  • 7 Ratings

Symptoms

  • Time in the virtual machine drifts ahead of real time
  • Time is not synced
  • Virtual machine does not keep time

Purpose

Windows multimedia timers are a service provided by Windows operating system to applications that provides high resolution callbacks for applications. Enabling, disabling, or changing the rate of callbacks can cause Windows to change the rate of interrupts requested from the hardware timer. When Windows is using the CMOS Real Time Clock (RTC) as the timer interrupt source, the act of changing the rate of the hardware timer can cause small amounts of time to be gained. If the rate is changed frequently, an appreciable amount of time might be gained in the virtual machine. 
 
Java applications commonly change the multimedia timer rate and might trigger the time gain issue. 

Resolution

When applications request a timer rate using the Windows Multimedia Timer interface, Windows changes the rate of timer interrupts generated by the hardware. The behavior of the CMOS RTC when changing the rate of timer interrupts is unspecified. When windows is using the CMOS RTC this can introduce a small error into Window's notion of time.

Affected Kernels

Versions of windows using the CMOS RTC for timekeeping interrupts. Whether Windows uses the CMOS RTC for timekeeping interrupts depends on which HAL it is using. The ACPI HALs are the ones that use the RTC. Which timers are in use can also be determined by looking at the TimeTrackerStats, which are described in Timekeeping in VMware Virtual Machines.

Solution

There are two possible solutions. 
 
VMware recommends avoiding frequent changes to the multimedia timer period. Unfortunately this requires support from the application using the multimedia timer. 
 
The other solution is to change the behavior of the virtual CMOS RTC to match the expectations of Windows. Starting with ESX/ESXi 3.5, the behavior of the CMOS RTC when its rate is changed now better matches the expectation of Windows. 
 
This table provides a breakdown of the product and action to workaround the issue:

Product Action
ESX 3.5 and later No action required.
ESX 3.0.3 Ensure patch ESX303-200910401-BG is applied.
ESX 3.0.2 Ensure patch ESX-1002087 is applied.
ESX 3.0.1 Ensure patch ESX-1002082 is applied.
ESX 3.0.0 Ensure patch ESX-1002081 is applied.
ESX 2.5.x and earlier Upgrade to ESX 3.0.0 or later.
Fusion 2.0 and later No action required.
Fusion 1.x Upgrade to Fusion 2.0 or later.
Player 2.0 and later No action required.
Player 1.x Upgrade to Player 2.0 or later.
Workstation 6.0 and later No action required.
Workstation 5.x Upgrade to Workstation 6.0 or later.

In some cases, it is possible to prevent the Windows multimedia timer interface from being used frequently. This involves not running the offending application or configuring it to not toggle the frequency of the timer. This is application specific and may not be possible. For applications using the Sun JVM, you can disable toggling of the frequency by passing '-XX:+ForceTimeHighResolution' to the JVM. The easiest way to do this is to set the _JAVA_OPTIONS environment variable.
 
To set the _JAVA_OPTIONS environment variable:
  1. Click Start > Settings > Control Panel > System > Advanced > Environment Variables.
  2. Click New under System Variables. The variable name is _JAVA_OPTIONS. The variable value is -XX:+ForceTimeHighResolution
  3. Reboot the guest operating system to ensure the variable is propagated properly.

Additional Information

Another issue with similar symptoms is described in, Time in virtual machine drifts due to hardware timer drift (1006072) .

See Also

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 7 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 7 Ratings
Actions
KB: