Timeshift inside a virtual machine makes me paranoid

Hi there!

I use virtual machines for many purposes as it allows me to compartmentalize and isolate different environments, easily back them up, migrate without having to reconfigure them, easily revert to a previous state thanks to snapshots and backups. It’s great.

But something happened recently which made me paranoid. On my Windows XP virtual machine I’ve noticed that time goes much faster than in actual life. It made paranoid: “what if in my other virtual machines time is also speeding/lagging behind even if to a lesser degree?”

Some applications depend on system clock and even though I’m not doing anything that requires atomic-clock level of precision inside my virtual machines having time run at 4x is not good either and so I’d like to learn more about why such things happen and how to avoid them? Are there some specific flags I should always set? Is it something specific to Windows XP VMs or just older VMs in general? I’d appreciate any help/advice. Thank you!

Host: Linux Mint
Virtualization: qemu/livirt/virt-manager with GPU pass-through
Guests: Windows XP/7/10/11, macOS, Linux
GPUs: K2000, WX 7100, RX 6600 (1st machine), RTX 4070, RTX 3060 (2nd machine)

UPDATE: added 2 videos to show what I’ve describing (1 minute inside VM passes in about 7 seconds of real time, 1 press of a keyboard button equals 10, mouse cursor is blinking very fast, resource usage graphs inside Task Manager are going crazy etc…)


Never heard of it, I know different OS and Hypervisor, but this is what I found:

Try disabling NTP inside windows xp and check if it makes a difference.

Take a look at the XML config for the domain using virt-manager.

What <clock> object do you have? I believe it defaults to the following for Windows guests:

  <clock offset="localtime">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <timer name="hypervclock" present="yes"/>
  </clock>

Linux expects the real time clock to represent UTC by default, whereas Windows expects it to be local time. Libvirt knows how to adjust the real time clock so that the guest sees it with an offset to localtime. So you need to make sure the “offset” property is localtime.

Otherwise the Windows guest may get a real time clock with a UTC value and when NTP starts to adjust, you will experience a time warp as the offset is applied.

https://libvirt.org/formatdomain.html#time-keeping

Also good to check that your hardware realtime clock has the proper UTC value with hwclock. You can also set the hardware realtime clock to the current operating system time with hwclock --systohc or the alias hwclock -w, which if you have NTP working will automatically correct your hardware clock.

1 Like