HOWTO fix freebsd clock times in vmware server

From Chaos

Jump to: navigation, search
This article is part of the HOWTO series.

Summary

On a regular basis, the clock on my vmware guest (FreeBSD 6.1) would be completely out of skew. For example, if the "real" time was reported as 3:38pm (15:38), the vmhost (upon running the command date), would report a time of 12:13pm.

Fix

The fix was actually fairly easy. Most FreeBSD kernels expect timecounters to tick every 100ms. This will equate to the sysctl kern.clockrate looking something like this:

kern.clockrate: { hz = 1000, tick = 10000, profhz = 66, stathz = 13 }

What it should look like is below, which will allow for more accurate time keeping in the FreeBSD vmhost:

kern.clockrate: { hz = 100, tick = 10000, profhz = 66, stathz = 13 }

To make this change permanent, I added a line to /boot/loader.conf that modifies the kern.hz sysctl:

kern.hz="100"

References

Personal tools