diff options
authorJan Kiszka <>2009-09-15 13:36:04 +0200
committerAnthony Liguori <>2009-10-05 09:32:45 -0500
commit21d5d12bb0ad4de7cc92a7a2d018e7ec0f9fd148 (patch)
tree3297270a5b65d8d59d8e114d7fe3105e1330dffa /qemu-timer.h
parentwin32: Drop dead dyntick timer code (diff)
Despite its name QEMU_CLOCK_REALTIME is (normally) not using CLOCK_REALTIME / the host system time as base. In order to allow also non-trivial RTC emulations (MC146818) to follow the host time instead of the virtual guest time, introduce the new clock type QEMU_CLOCK_HOST. It is unconditionally based on CLOCK_REALTIME, thus will follow system time changes of the host. The only limitation of its current implementation is that pending host_clock timers may not fire early if the host time is pushed forward beyond their expiry. So far no urgent need to overcome this limitation was identified, so it's left as simple as it is (expiry on next alarm timer tick). Signed-off-by: Jan Kiszka <> Signed-off-by: Anthony Liguori <>
Diffstat (limited to 'qemu-timer.h')
1 files changed, 7 insertions, 0 deletions
diff --git a/qemu-timer.h b/qemu-timer.h
index e44c33420..e7eaa0436 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -17,6 +17,13 @@ extern QEMUClock *rt_clock;
precision clock, usually cpu cycles (use ticks_per_sec). */
extern QEMUClock *vm_clock;
+/* The host clock should be use for device models that emulate accurate
+ real time sources. It will continue to run when the virtual machine
+ is suspended, and it will reflect system time changes the host may
+ undergo (e.g. due to NTP). The host clock has the same precision as
+ the virtual clock. */
+extern QEMUClock *host_clock;
int64_t qemu_get_clock(QEMUClock *clock);
QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);