Big Ben

Keeping the system clock on the right time is troublesome for a virtual machine if VM guest tools are not available to synchronise clocks. As the guest OS does not have access to the hardware clock it relies on software to tick over its own clock, and inaccuracies generally lead to slowdown (although over-compensation for loss of timer ticks may gain time).

Changing any system's time can be risky - an OS relies on a contiguous series of time values. If a system event is scheduled to occur at a specified time and the clock is set forward beyond it, that time never occurs and the event will not occur.

Network Time Protocol (ntpd) avoids this problem by making minuscule adjustments to the clock frequency (the slew), effectively shortening the length of a unit of time to the OS. man ntpd states:

The slew rate of typical Unix kernels is limited to 0.5 ms/s, so for every second that the clock requires adjusting, 2000s are required to adjust it.

For a development VM that is off for periods of time this slew rate is too slow, and if the machine doesn't run time-critical services ntpd can be configured to absolutely set the system time.

What

  • Synchronise clock of virtual machine using ntp

Why

  • Guest additions not available

Risks

  • Time-based system events not occurring

How

  1. Edit /etc/sysconfig/ntpd and add the -x flag (mine looks like this):
    OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -x"
    On startup the ntpd daemon will set the time irrespective of how incorrect it currently is.
  2. Add this line in the root crontab to refresh the time every 5 minutes.
    */5 * * * * /sbin/service ntpd restart >> /tmp/ntpd.log 2>&1



Here is a detailed explanation of Timekeeping in VMWare and What is a Reference Clock? from ntp.org's FAQ.