Support > Knowledge Base
Knowledge Base

Search the Knowledge Base: |
Search the Knowledge Base: |
Time in a Linux virtual machine jumps backward when using clock=pit
Symptoms
- Time jumps backward
-
Time is off by approximately 1 jiffy
-
A program that uses the gettimeofday system call sees that the results are not monotonically increasing
Resolution
Background
Occasionally, gettimeofday returns a time that is approximately one jiffy earlier than the previously returned value. If the kernel was compiled with HZ=100, the backward jumps are up to approximately 10ms. If the kernel was compiled with HZ=1000, the backward jumps are up to 1ms. For more information, see Determining the rate of timer interrupts a guest operating system requests (1005802).
An example of a sequence of return values from gettimeofday exhibiting this issue (on a kernel with HZ=1000):
- 1141873584.825298 seconds
- 1141873584.825303 seconds
- 1141873584.824319 seconds (The issue manifests here)
- 1141873584.824323 seconds
Affected Kernels: Linux 2.6.0 - 2.6.17
Note : This issue is a Linux bug. It can occur on physical hardware as well as virtual hardware.
Solution
Use clock=pmtmr instead of clock=pit and run NTP in the guest to correct for lost tick over compensation. For more information, see Time in a Linux 2.6 guest runs faster than real time due to lost tick overcompensation (1006113).
Note: When using the PM timer for timekeeping (clock=pmtmr in 32bit virtual machines or notsc on 64bit virtual machines) gettimeofday may jump backward by 1us in SMP virtual machines.
Feedback
Actions
- KB Article: 1006086
- Updated: Aug 14, 2009
- Products:
VMware ACE
VMware ESX
VMware ESXi
VMware Fusion
VMware GSX Server
VMware Player
VMware Server
VMware Workstation

