3

I have a Windows VM running with kvm/qemu which is experiencing time drift. What would be the optimal libvirt settings for a Windows guest?

Currently I am using this, but it did not help:

<clock offset='localtime'>
  <timer name='rtc' tickpolicy='catchup' track='guest'>
    <catchup threshold='123' slew='120' limit='10000'/>
  </timer>
</clock>
Mureinik
  • 297,002
  • 52
  • 306
  • 350
Jochen
  • 1,853
  • 3
  • 20
  • 28

1 Answers1

5

This did the trick for me:

<clock offset='localtime'>
  <timer name='rtc' tickpolicy='catchup' track='guest'/>
  <timer name='pit' tickpolicy='delay'/>
  <timer name='hpet' present='no'/>
</clock>

you also need to make sure Windows uses the platformclock when booting:

bcdedit /set USEPLATFORMCLOCK on
Jochen
  • 1,853
  • 3
  • 20
  • 28
  • I have just P2Vd a Server 2003 and had to edit the boot.ini with an additional boot paramater "/use pmtimer" as bcdedit is for Vista/Server 2003 and newer. – NGRhodes Mar 25 '15 at 10:29
  • @Jochen will this work after stop/starting the windows guest? It didnt work for me in my setup after stopping and starting the vm. I set timezone to PDT and after stopping and starting the vm, it reset back to UTC – rakesh Sep 14 '20 at 07:49
  • Didn't help for me now in 2021. Host is Debian Buster, qemu-kvm version is 3.1. – Alexandr Zarubkin Nov 29 '21 at 20:57
  • In my case, it was SQL Server 2005. I had to add trace flag 8038 to the startup parameters and it fixed the time drift. Reference: https://pve.proxmox.com/wiki/Performance_Tweaks#Trace_Flag_T8038_with_Microsoft_SQL_Server – Alexandr Zarubkin Nov 30 '21 at 08:26