0

On a QEMU main host, I have many hosted centos VM running.

For test purpose, I change system date/time on these VM, but not on the main host.

I get strange behavior when getting dates via cpp calls.

I noticed 'hwclock -r' on a VM returns the main host date-time, while on VM date, or calls to localtime and time.h's stuff returns VM time

hope to be clear enough to get your lights...

Overnuts
  • 121
  • 6
  • What you describe sounds entirely normal at first read. That is, you're changing the time on your VMs yet see that the "hardware" clock is still the host time - which it should be, as these are VMs. Are you having some kind of problem because of this behavior? I ask because while it's fairly normal, it can be potentially changed to suit your needs. – Spooler Nov 04 '16 at 08:31
  • well, I get troubles, but I can't find where the bug is. using time_t, time(), locatime(), do you know if there's a maximum offset between hwclock and VM datetime ? In a "normal" way, this should not be more than a few days, I my case, it's about 3 months – Overnuts Nov 04 '16 at 08:38
  • 2
    Wall clocks for virtualization have been pretty awful. Guests typically use TSC, which is highly prone to time offset during heavy CPU cycles (or really just a gentle breeze outside). KVM uses a paravirtualized interface for clocks, but it's still not great. If you're at all concerned with keeping time on guests, their clocks need to be controlled by NTP. The host, too. – Spooler Nov 04 '16 at 09:47
  • 1
    Also turn off any power management on the host. the TSC clock module will fly around wildly if power management features change the speed of the CPU on either the guest or the host. – Spooler Nov 04 '16 at 09:49

0 Answers0