# Timekeeping within a VirtualBox VM



## X-Istence (Dec 12, 2008)

Hello,

I am running FreeBSD 7.0 within a VirtualBox environment and am having some issues with timekeeping. Every 30 or so seconds I lose about 13 seconds of time within the VM.


```
uname -a
FreeBSD FreeBSD-virtual.network.lan 7.0-RELEASE-p6 FreeBSD 7.0-RELEASE-p6 #0: Mon Nov 24 06:43:33 UTC 2008     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
```

I have attempted to use ntpd to keep the time in sync, but it is just to slow for the huge amount of loses that occur.

I have also attempted to switch the timecounters to each of the following, no dice.


```
Timecounter "i8254" frequency 1193182 Hz quality 0
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0
pmtimer0 on isa0
Timecounter "TSC" frequency 2700057702 Hz quality 800
Timecounters tick every 10.000 msec
```


```
kern.timecounter.tick: 1
kern.timecounter.choice: TSC(800) ACPI-safe(850) i8254(0) dummy(-1000000)
kern.timecounter.hardware: ACPI-safe
kern.timecounter.nsetclock: 3
kern.timecounter.ngetmicrotime: 116072
kern.timecounter.ngetnanotime: 1
kern.timecounter.ngetbintime: 0
kern.timecounter.ngetmicrouptime: 28926
kern.timecounter.ngetnanouptime: 87
kern.timecounter.ngetbinuptime: 512
kern.timecounter.nmicrotime: 608
kern.timecounter.nnanotime: 73
kern.timecounter.nbintime: 681
kern.timecounter.nmicrouptime: 807
kern.timecounter.nnanouptime: 7
kern.timecounter.nbinuptime: 11546
kern.timecounter.stepwarnings: 0
kern.timecounter.tc.i8254.mask: 4294967295
kern.timecounter.tc.i8254.counter: 39980
kern.timecounter.tc.i8254.frequency: 1193182
kern.timecounter.tc.i8254.quality: 0
kern.timecounter.tc.ACPI-safe.mask: 4294967295
kern.timecounter.tc.ACPI-safe.counter: 3903550042
kern.timecounter.tc.ACPI-safe.frequency: 3579545
kern.timecounter.tc.ACPI-safe.quality: 850
kern.timecounter.tc.TSC.mask: 4294967295
kern.timecounter.tc.TSC.counter: 2381816119
kern.timecounter.tc.TSC.frequency: 2700057702
kern.timecounter.tc.TSC.quality: 800
kern.timecounter.smp_tsc: 0
```


```
sysctl -a | grep clockrate
kern.clockrate: { hz = 100, tick = 10000, profhz = 1024, stathz = 128 }
hw.clockrate: 2700
```

Is there anything I can do short of running ntpdate every 5 seconds?

This is the info from VirtualBox:


```
VBoxManage showvminfo "FreeBSD 32-Bit"
VirtualBox Command Line Management Interface Version 2.0.6
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Name:            FreeBSD 32-Bit
Guest OS:        FreeBSD
UUID:            cfc809da-82f9-455c-a1c4-6dc4a33f4e43
Config file:     /root/.VirtualBox/Machines/FreeBSD 32-Bit/FreeBSD 32-Bit.xml
Memory size:     512MB
VRAM size:       8MB
Boot menu mode:  message and menu
ACPI:            on
IOAPIC:          off
PAE:             off
Time offset:     0 ms
Hardw. virt.ext: on
Nested Paging:   on
State:           running (since 2008-12-12T08:46:57.631000000)
Monitor count:   1
Floppy:          empty
SATA:            disabled
Primary master:  /storage/virtualbox/VirtualDisks/FreeBSD 32-Bit.vdi (UUID: 3306e83d-154c-4b2e-963e-20849c13c57b)
DVD:             /storage/virtualbox/ISO/7.0-RELEASE-i386-disc1.iso (UUID: 812fc4ca-ea5d-4f7d-8d36-29156afcd9d0)
NIC 1:           MAC: 00179AB95AE1, Attachment: Host Interface 'skge0 - SksKonnect Gigabit Ethernet', Cable connected: on, Trace: off (file: none), Type: 82543GC, Reported speed: 0 Mbps
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
UART 1:          disabled
UART 2:          disabled
Audio:           disabled (Driver: Unknown, Controller: Unknown)
Clipboard Mode:  Bidirectional
Video mode:      720x400x0
VRDP:            disabled
Shared folders:  <none>

VRDP Connection:    not active
Clients so far:     0

Guest:

Statistics update:                   disabled
```

This is running on top of a OpenSolaris 2008.11 host machine.


```
uname -a
SunOS Keyhole.network.lan 5.11 snv_101b i86pc i386 i86pc Solaris
```


----------

