Product SiteDocumentation Site

9.10. Virtual machine timer management with libvirt

Accurate time keeping on guests is a key challenge for virtualization platforms. Different hypervisors attempt to handle the problem of time keeping in a variety of ways. Libvirt provides hypervisor independent configuration settings for time management, using the <clock> and <timer> elements in the domain XML. The domain XML can be edited using the virsh edit command. See Editing a guest's configuration file for details.
The clock element is used to determine how the guest clock is synchronized with the host clock. The clock element has the following attributes:
Example 9.1. Always synchronize to UTC
<clock offset="utc" />

Example 9.2. Always synchronize to the host timezone
<clock offset="localtime" />

Example 9.3. Synchronize to an arbitrary timezone
<clock offset="timezone" timezone="Europe/Paris" />

Example 9.4. Synchronize to UTC + arbitrary offset
<clock offset="variable" adjustment="123456" />

A clock element can have zero or more timer elements as children. The timer element specifies a time source used for guest clock synchronization. The timer element has the following attributes. Only the name is required, all other attributes are optional.
Example 9.5. Clock synchronizing to local time with RTC and PIT timers, and the HPET timer disabled
<clock offset="localtime">
	<timer name="rtc" tickpolicy="catchup" wallclock="guest" />
	<timer name="pit" tickpolicy="delay" />
	<timer name="hpet" present="no" />