问题原文
原帖链接 · zimbatm · CC BY-SA 3.0
Couldn't the guests somehow inherit the system time of the host ?
It seems kind of pointless to run the same daemon to get the same results on the same machine multiple times but I didn't find anything related to time when reading KVM or Xen articles. My understanding is that the guest gets the host time on boot but that it might then drift apart. Is that correct ?
已采纳解答
原帖链接 · the-wabbit · CC BY-SA 3.0
This is correct. It should be noted that time not only "can" drift away, but will drift away due to the fact that intervals between timer interrupts (which timekeeping on OS is often based on) are stretched and compressed as the hypervisor would see fit.
A commonly taken workaround across most virtualization platforms (Hyper-V integration services, VMWare tools) is running a daemon on the guest which periodically synchronizes clocks with the VM host. As noted by Hauke in a comment to your question, KVM additionally provides a paravirtualized clock which would need the respective driver loaded on the guest OS to work.
Further reading:Timekeeping in VMWare Virtual Machines (vmware.com)
KVM guests clock synchronisation (s19n.net)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
