Finding the current time drift

You can use the qvm debug option to enable retrieving a guest's current time drift.

To get information about a guest's current time drift:

  1. When you configure the VM for your guest, add the option to the configuration for the guest's qvm process instance (see debug).
  2. Send a SIGUSR1 to the qvm process instance hosting the guest.

The qvm process instance will output time information to its configured output location; for example:

# =======================================================================
Features: 0
Current host time:        8c50ccb052
Current guest time:       33743c4cd
Current drift:            a2e

Both the guest and host times are expressed in clock cycles, retrieved from the highest frequency clock available on your system (see ClockCycles() in the C Library Reference for an explanation of how to get a value for the number of clock cycle increments per second (CPS)).

In the example above, assuming that the CPS is 0x8f0d1c9c, or 0.42 nanoseconds, the current drift of 0xa2e (2606) is:

2606 * 0.42 = 1095

nanoseconds, or approximately 1.1 microseconds.

Note: Of course, the act of looking at the drift takes time, so the results of your query will always be a little stale.